]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/string.c
Fix ITS#1843, don't deref NULL string in ldap_pvt_str2upper
[openldap] / libraries / libldap / string.c
index aaf76c609d6f45174d96c833c94d0385fabc3c05..ee275baec66cee7c47a0806484fb8e1ebde1e1ec 100644 (file)
@@ -103,8 +103,10 @@ ldap_pvt_str2upper( char *str )
        char    *s;
 
        /* to upper */
-       for ( s = str; *s; s++ ) {
-               *s = TOUPPER( (unsigned char) *s );
+       if ( str ) {
+               for ( s = str; *s; s++ ) {
+                       *s = TOUPPER( (unsigned char) *s );
+               }
        }
 
        return( str );
@@ -116,8 +118,10 @@ ldap_pvt_str2lower( char *str )
        char    *s;
 
        /* to lower */
-       for ( s = str; *s; s++ ) {
-               *s = TOLOWER( (unsigned char) *s );
+       if ( str ) {
+               for ( s = str; *s; s++ ) {
+                       *s = TOLOWER( (unsigned char) *s );
+               }
        }
 
        return( str );