From: Howard Chu Date: Mon, 26 Aug 2002 13:10:16 +0000 (+0000) Subject: Import ITS#1935 fix from HEAD - overflow in ldap_pvt_hex_unescape() X-Git-Tag: OPENLDAP_REL_ENG_2_0_26~19 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=114d16494c3cd562405299c27597e3e4f56ae15d;p=openldap Import ITS#1935 fix from HEAD - overflow in ldap_pvt_hex_unescape() --- diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 0ac1b6f63b..77171a51df 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -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; }