]> git.sur5r.net Git - openldap/commitdiff
Fix UTF8StringNormalize overrun on zero-length string
authorHoward Chu <hyc@openldap.org>
Thu, 6 Oct 2011 21:05:31 +0000 (14:05 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 2 Nov 2011 23:35:57 +0000 (16:35 -0700)
Detected by valgrind

servers/slapd/schema_init.c

index 67508fc70db2862e451de0b00adb8dc2618037a2..56d690ba833ec2412973b4183d179050fdd568ff 100644 (file)
@@ -1852,7 +1852,7 @@ UTF8StringNormalize(
                }
                nvalue.bv_val[nvalue.bv_len] = '\0';
 
-       } else {
+       } else if ( nvalue.bv_len )  {
                /* string of all spaces is treated as one space */
                nvalue.bv_val[0] = ' ';
                nvalue.bv_val[1] = '\0';