Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/netpgp/dist/src/pgp2ssh Fix previous dif...



details:   https://anonhg.NetBSD.org/src/rev/c8f03d25e066
branches:  trunk
changeset: 757671:c8f03d25e066
user:      agc <agc%NetBSD.org@localhost>
date:      Sat Sep 11 04:08:34 2010 +0000

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

diffstat:

 crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c |  9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diffs (33 lines):

diff -r 52064c7549ad -r c8f03d25e066 crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c
--- a/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c Sat Sep 11 03:10:57 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/pgp2ssh/b64.c Sat Sep 11 04:08:34 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index