mirror of
https://github.com/mpv-player/mpv
synced 2025-01-11 17:39:38 +00:00
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
This commit is contained in:
parent
3707a1426b
commit
152284fb0f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user