Hi,

Seems there is a minor typo in the base64 encoding fns, in the file auth.c:

(base64 rfc says that an integral quantum (4 bytes) is always generated when encoding 24 binary bits into 32 base64 bits. Dealing with incomplete quantums goes like so:

- 8  bits in the last 24-bit quantum -> two "="'s at the end
- 16 bits in the last 24-bit quantum -> one "=" at the end

Attached patch fixes the two typos. Also, I suppose that the terminating null char at the end shouldn't count as decoded data.


Hope I'm not missing something obvious,
Bogdan
Index: auth.c
===================================================================
--- auth.c	(revision 195)
+++ auth.c	(working copy)
@@ -411,9 +411,9 @@
 		else x4=-1;
 		if (x2!=-1) {
 			out[j++]=(x1<<2) | ((x2 & 0x30)>>4);
-			if (x3==-1) {
+			if (x3!=-1) {
 				out[j++]=((x2 & 0x0F)<<4) | ((x3 & 0x3C)>>2);
-				if (x4==-1) {
+				if (x4!=-1) {
 					out[j++]=((x3 & 0x03)<<6) | (x4 & 0x3F);
 				}
 			}
@@ -421,7 +421,7 @@
 			
 	}
 			
-	out[j++] = 0;
+	out[j] = 0;
 	*newlen=j;
 	return out;
 }
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to