diff options
author | uau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-28 19:25:03 +0000 |
---|---|---|
committer | uau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-28 19:25:03 +0000 |
commit | 152284fb0f906aa9f12bdbd266173be255937706 (patch) | |
tree | 2de672c53a86ea043cd8c82bb3c79fd4a92a3873 /stream | |
parent | 3707a1426b5563394f75bf09eefd9f8826bfbd33 (diff) |
Fix base64_encode() max output length checking.
Made HTTP auth fail if sum of username+password lengths was below 3.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22049 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/http.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/stream/http.c b/stream/http.c index 42c226b16c..103b6e83a4 100644 --- a/stream/http.c +++ b/stream/http.c @@ -680,7 +680,7 @@ base64_encode(const void *enc, int encLen, char *out, int outMax) { shift = 0; outMax &= ~3; - while( outLen<outMax ) { + while(1) { if( encLen>0 ) { // Shift in byte bits <<= 8; @@ -706,15 +706,14 @@ base64_encode(const void *enc, int encLen, char *out, int outMax) { // 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 |