Import ITS#1935 fix from HEAD - overflow in ldap_pvt_hex_unescape()

This commit is contained in:
Howard Chu 2002-08-26 13:10:16 +00:00
parent 68fd171c11
commit 114d16494c

View 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;
}