summaryrefslogtreecommitdiff
path: root/usr/src/lib/libldap5/sources/ldap/common/unescape.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libldap5/sources/ldap/common/unescape.c')
-rw-r--r--usr/src/lib/libldap5/sources/ldap/common/unescape.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr/src/lib/libldap5/sources/ldap/common/unescape.c b/usr/src/lib/libldap5/sources/ldap/common/unescape.c
index 65de7c03b4..70aae09642 100644
--- a/usr/src/lib/libldap5/sources/ldap/common/unescape.c
+++ b/usr/src/lib/libldap5/sources/ldap/common/unescape.c
@@ -44,12 +44,15 @@ nsldapi_hex_unescape( char *s )
for ( p = s; *s != '\0'; ++s ) {
if ( *s == '%' ) {
- if ( *++s != '\0' ) {
- *p = unhex( *s ) << 4;
+ if ( *++s == '\0' ) {
+ break;
}
- if ( *++s != '\0' ) {
- *p++ += unhex( *s );
+ *p = unhex( *s ) << 4;
+ if ( *++s == '\0' ) {
+ break;
}
+ *p++ += unhex( *s );
+
} else {
*p++ = *s;
}