From 027cba6a49fa1b7ed81d22d3cac7cc1d469d547a Mon Sep 17 00:00:00 2001 From: Brendan Powers Date: Mon, 14 Dec 2009 20:28:48 -0500 Subject: [PATCH] Return NULL in strlower_talloc if src is NULL Prevents strlower_talloc from segfaulting if you pass it a NULL string. Signed-off-by: Andrew Bartlett --- lib/util/charset/util_unistr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c index 045aa4a3e3f..f8207261c5f 100644 --- a/lib/util/charset/util_unistr.c +++ b/lib/util/charset/util_unistr.c @@ -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); -- 2.34.1