Module Name:    src
Committed By:   agc
Date:           Sat Sep 11 04:08:35 UTC 2010

Modified Files:
        src/crypto/external/bsd/netpgp/dist/src/pgp2ssh: b64.c

Log Message:
Fix previous differently to avoid over-padding the base64 encoded output,
by being smarter in the decode stage.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    src/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c
diff -u src/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c:1.2 src/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c:1.3
--- src/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c:1.2	Fri Sep 10 04:57:17 2010
+++ src/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c	Sat Sep 11 04:08:34 2010
@@ -274,11 +274,6 @@
 			}
 		}
 	}
-	if (wordlen == 3 && (size_t)(outp - out) < outsize - 4) {
-		for (i = 0 ; i < 4 ; i++) {
-			*outp++ = '=';
-		}
-	}
 	return (int)(outp - out);
 }
 
@@ -315,7 +310,7 @@
 	for (inp = in, outp = out ; (size_t)(inp - in) < insize && (size_t)(outp - out) < outsize ; ) {
 		for (wordlen = 0, i = 0 ; i < sizeof(wordin) && (size_t)(inp - in) < insize ; i++) {
 			/* get a single character */
-			for (v = 0; (size_t)(inp - in) < insize && v == 0 ; ) {
+			for (v = 0; (size_t)(inp - in) <= insize && v == 0 ; ) {
 				if (*inp == '\r' && *(inp + 1) == '\n') {
 					inp += 2;
 				} else {
@@ -327,7 +322,7 @@
 				}
 			}
 			/* perhaps 0x0 pad */
-			if ((size_t)(inp - in) < insize) {
+			if ((size_t)(inp - in) <= insize) {
 				wordlen += 1;
 				if (v) {
 					wordin[i] = (uint8_t) (v - 1);

Reply via email to