projects
/
platform
/
upstream
/
libav.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5a9ee31
)
avio: Check for invalid buffer length.
author
Alex Converse
<alex.converse@gmail.com>
Sat, 15 Oct 2011 01:27:59 +0000
(18:27 -0700)
committer
Alex Converse
<alex.converse@gmail.com>
Mon, 17 Oct 2011 06:56:21 +0000
(23:56 -0700)
libavformat/aviobuf.c
patch
|
blob
|
history
diff --git
a/libavformat/aviobuf.c
b/libavformat/aviobuf.c
index
b5e9d4c
..
8f3599a
100644
(file)
--- a/
libavformat/aviobuf.c
+++ b/
libavformat/aviobuf.c
@@
-769,13
+769,14
@@
int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen)
{
int i;
+ if (buflen <= 0)
+ return AVERROR(EINVAL);
// reserve 1 byte for terminating 0
buflen = FFMIN(buflen - 1, maxlen);
for (i = 0; i < buflen; i++)
if (!(buf[i] = avio_r8(s)))
return i + 1;
- if (buflen)
- buf[i] = 0;
+ buf[i] = 0;
for (; i < maxlen; i++)
if (!avio_r8(s))
return i + 1;
@@
-787,6
+788,8
@@
int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen)
{\
char* q = buf;\
int ret = 0;\
+ if (buflen <= 0) \
+ return AVERROR(EINVAL); \
while (ret + 1 < maxlen) {\
uint8_t tmp;\
uint32_t ch;\