diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-08-21 10:08:29 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:15:49 +0200 |
commit | a4e62de5dc1cf79a80a79e56dd58cd151f008429 (patch) | |
tree | b1c215726103625fca8205e8c124414f81fa5008 /stream | |
parent | 39e80404fad555a01276138f7606b0f9db65d731 (diff) |
stream: make stream_read_line() terminate line on EOF
Make sure we return an "empty" line on eof, to make sure we get
no buffer overflows in case some code fails to check the return value.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31999 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/stream/stream.c b/stream/stream.c index b562c56cfe..6547771111 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -620,7 +620,7 @@ unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max, int utf } s->buf_pos += len; } while(!end); - if(s->eof && ptr == mem) return NULL; ptr[0] = 0; + if(s->eof && ptr == mem) return NULL; return mem; } |