[MPlayer-cvslog] r22049 - trunk/stream/http.c

uau subversion at mplayerhq.hu
Sun Jan 28 20:25:03 CET 2007


Author: uau
Date: Sun Jan 28 20:25:03 2007
New Revision: 22049

Modified:
   trunk/stream/http.c

Log:
Fix base64_encode() max output length checking.
Made HTTP auth fail if sum of username+password lengths was below 3.


Modified: trunk/stream/http.c
==============================================================================
--- trunk/stream/http.c	(original)
+++ trunk/stream/http.c	Sun Jan 28 20:25:03 2007
@@ -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



More information about the MPlayer-cvslog mailing list