Return NULL in strlower_talloc if src is NULL
authorBrendan Powers <brendan0powers@gmail.com>
Tue, 15 Dec 2009 01:28:48 +0000 (20:28 -0500)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 18 Dec 2009 03:27:43 +0000 (14:27 +1100)
Prevents strlower_talloc from segfaulting if you pass it a NULL string.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
lib/util/charset/util_unistr.c

index 045aa4a3e3f4922a4df2c86d13e33425b5d05ae1..f8207261c5fbb9fbd04359c318d3f8381a2cb651 100644 (file)
@@ -430,6 +430,10 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
        char *dest;
        struct smb_iconv_convenience *iconv_convenience = get_iconv_convenience();
 
+       if(src == NULL) {
+               return NULL;
+       }
+
        /* this takes advantage of the fact that upper/lower can't
           change the length of a character by more than 1 byte */
        dest = talloc_array(ctx, char, 2*(strlen(src))+1);