[asterisk-commits] tilghman: trunk r41103 - /trunk/main/utils.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Aug 25 10:48:35 MST 2006


Author: tilghman
Date: Fri Aug 25 12:48:34 2006
New Revision: 41103

URL: http://svn.digium.com/view/asterisk?rev=41103&view=rev
Log:
Off by one error in buffer length (issue 7379)

Modified:
    trunk/main/utils.c

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?rev=41103&r1=41102&r2=41103&view=diff
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Fri Aug 25 12:48:34 2006
@@ -363,7 +363,7 @@
 		byte |= *(src++);
 		bits += 8;
 		cntin++;
-		if ((bits == 24) && (cnt + 4 < max)) {
+		if ((bits == 24) && (cnt + 4 <= max)) {
 			*dst++ = base64[(byte >> 18) & 0x3f];
 			*dst++ = base64[(byte >> 12) & 0x3f];
 			*dst++ = base64[(byte >> 6) & 0x3f];
@@ -379,7 +379,7 @@
 			col = 0;
 		}
 	}
-	if (bits && (cnt + 4 < max)) {
+	if (bits && (cnt + 4 <= max)) {
 		/* Add one last character for the remaining bits, 
 		   padding the rest with 0 */
 		byte <<= 24 - bits;



More information about the asterisk-commits mailing list