avoid segfault when calling sanitize_string() on NULL

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
This commit is contained in:
Daniel Kahn Gillmor 2011-05-28 14:51:52 -07:00 committed by Carl Worth
parent d3fdb76c8d
commit 8a7d4aa1b1

View file

@ -116,6 +116,9 @@ sanitize_string (const void *ctx, const char *str)
{ {
char *out, *loop; char *out, *loop;
if (NULL == str)
return NULL;
loop = out = talloc_strdup (ctx, str); loop = out = talloc_strdup (ctx, str);
for (; *loop; loop++) { for (; *loop; loop++) {