Fix possible integer overflow in malloc by using calloc instead.

Should fix CVE-2008-0073 as far as MPlayer is affected by this problem.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26299 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-03-29 11:35:29 +00:00
parent 33dc71664e
commit 54c48f18a1
1 changed files with 2 additions and 1 deletions

View File

@ -330,7 +330,8 @@ sdpplin_t *sdpplin_parse(char *data) {
if(filter(data,"a=StreamCount:integer;",&buf)) {
desc->stream_count=(unsigned int)atoi(buf);
desc->stream=malloc(sizeof(sdpplin_stream_t*)*desc->stream_count);
desc->stream=calloc(desc->stream_count, sizeof(sdpplin_stream_t*));
if (!desc->stream) desc->stream_count = 0;
handled=1;
data=nl(data);
}