From 114d16494c3cd562405299c27597e3e4f56ae15d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 26 Aug 2002 13:10:16 +0000 Subject: [PATCH] Import ITS#1935 fix from HEAD - overflow in ldap_pvt_hex_unescape() --- libraries/libldap/url.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.39.5