Mercurial > mplayer.hg
diff stream/http.c @ 22031:48036dc7f9d9
Fix base64_encode() max output length checking.
Made HTTP auth fail if sum of username+password lengths was below 3.
author | uau |
---|---|
date | Sun, 28 Jan 2007 19:25:03 +0000 |
parents | f43ed7e03b06 |
children | d261f5109660 |
line wrap: on
line diff
--- a/stream/http.c Sun Jan 28 17:52:59 2007 +0000 +++ b/stream/http.c Sun Jan 28 19:25:03 2007 +0000 @@ -680,7 +680,7 @@ shift = 0; outMax &= ~3; - while( outLen<outMax ) { + while(1) { if( encLen>0 ) { // Shift in byte bits <<= 8; @@ -706,15 +706,14 @@ // Encode 6 bit segments while( shift>=6 ) { + if (outLen >= outMax) + return -1; shift -= 6; *out = b64[ (bits >> shift) & 0x3F ]; out++; outLen++; } } - - // Output overflow - return -1; } //! If this function succeeds you must closesocket stream->fd