]> git.sur5r.net Git - openldap/commitdiff
Apply Ken McGarrahan's ldif padding fix.
authorKurt Zeilenga <kurt@openldap.org>
Sun, 25 Oct 1998 18:57:03 +0000 (18:57 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 25 Oct 1998 18:57:03 +0000 (18:57 +0000)
libraries/libldif/line64.c

index 2a3a1708f1b6cd6e2d2b6d34c302eb4479d32553..429e1d6ab18f6cf3027b45d20a89b7c071390283 100644 (file)
@@ -276,12 +276,12 @@ put_type_and_value( char **out, char *t, char *val, int vlen )
                                        len = 1;
                                }
 
-                               /* get b64 digit from low order 6 bits */
-                               *(*out)++ = nib2b64[ (bits & 0xfc0000L) >> 18 ];
-                       }
-
-                       for ( ; pad > 0; pad-- ) {
-                               *(*out - pad) = '=';
+                               if( i + pad < 4 ) {
+                                       /* get b64 digit from low order 6 bits */
+                                       *(*out)++ = nib2b64[ (bits & 0xfc0000L) >> 18 ];
+                               } else {
+                                       *(*out)++ = '=';
+                               }
                        }
                }
        }