diff options
author | Brendan Powers <brendan0powers@gmail.com> | 2009-12-14 20:28:48 -0500 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-12-18 14:27:43 +1100 |
commit | 027cba6a49fa1b7ed81d22d3cac7cc1d469d547a (patch) | |
tree | c1ff91a85cd5bae05095a3c48d47f85209874bb1 | |
parent | c3d1e5ca0c9f8d6c59a6fd4252a6e275b35e06de (diff) | |
download | samba-027cba6a49fa1b7ed81d22d3cac7cc1d469d547a.tar.gz samba-027cba6a49fa1b7ed81d22d3cac7cc1d469d547a.tar.bz2 samba-027cba6a49fa1b7ed81d22d3cac7cc1d469d547a.zip |
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 <abartlet@samba.org>
-rw-r--r-- | 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 045aa4a3e3..f8207261c5 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); |