]> 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)
committerHoward Chu <hyc@openldap.org>
Thu, 6 Oct 2011 21:06:59 +0000 (14:06 -0700)
Detected by valgrind

servers/slapd/schema_init.c

index da2274c1b6193e15b529bfce19b1876e718da34c..c2e79d0e0b2cff682fed8015ebf47dcde8bd882f 100644 (file)
@@ -1853,7 +1853,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';