From 1e4f4f6d921961c02398e51b97c6ff0c0bdf561d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 25 Feb 2013 14:58:45 +0100 Subject: s4-client: Make sure entry is a valid string. Reviewed-by: David Disseldorp --- source4/client/client.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source4/client/client.c b/source4/client/client.c index 43b0903cdc..66c21dfc54 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -454,7 +454,13 @@ static void adjust_do_list_queue(void) static void add_to_do_list_queue(const char* entry) { char *dlq; - long new_end = do_list_queue_end + ((long)strlen(entry)) + 1; + long new_end; + + if (entry == NULL) { + entry = ""; + } + + new_end = do_list_queue_end + ((long)strlen(entry)) + 1; while (new_end > do_list_queue_size) { do_list_queue_size *= 2; @@ -475,7 +481,7 @@ static void add_to_do_list_queue(const char* entry) } if (do_list_queue) { - strlcpy(do_list_queue + do_list_queue_end, entry ? entry : "", + strlcpy(do_list_queue + do_list_queue_end, entry, do_list_queue_size - do_list_queue_end); do_list_queue_end = new_end; DEBUG(4,("added %s to do_list_queue (start=%d, end=%d)\n", -- cgit