]> git.sur5r.net Git - openldap/commitdiff
Import ITS#1935 fix from HEAD - overflow in ldap_pvt_hex_unescape()
authorHoward Chu <hyc@openldap.org>
Mon, 26 Aug 2002 13:10:16 +0000 (13:10 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 26 Aug 2002 13:10:16 +0000 (13:10 +0000)
libraries/libldap/url.c

index 0ac1b6f63b480a526c5d1930b86e18c3cbd3aa57..77171a51dfa588fa72d37a26587051d10651abfd 100644 (file)
@@ -989,12 +989,14 @@ ldap_pvt_hex_unescape( char *s )
 
        for ( p = s; *s != '\0'; ++s ) {
                if ( *s == '%' ) {
-                       if ( *++s != '\0' ) {
-                               *p = ldap_pvt_unhex( *s ) << 4;
+                       if ( *++s == '\0' ) {
+                               break;
                        }
-                       if ( *++s != '\0' ) {
-                               *p++ += ldap_pvt_unhex( *s );
+                       *p = ldap_pvt_unhex( *s ) << 4;
+                       if ( *++s == '\0' ) {
+                               break;
                        }
+                       *p++ += ldap_pvt_unhex( *s );
                } else {
                        *p++ = *s;
                }