From feba7a68d7a465cc73d55013a04c1eb0c14bf56f 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. --- lib/util/charset/util_unistr.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c index 045aa4a..f820726 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); -- 1.5.4.3