From b1dbb99f5c58a006ab1ec129a3452da89bfe08a0 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 30 Jan 2020 21:56:44 +0000 Subject: [PATCH] [core] scan-build: Null pointer passed as an argument to a 'nonnull' parameter - switch_event_base_add_header() --- src/switch_event.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/switch_event.c b/src/switch_event.c index 8b8d57250c..c2b03b54a7 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1114,7 +1114,11 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc redraw: len = 0; for(j = 0; j < header->idx; j++) { - len += strlen(header->array[j]) + 2; + len += 2; + if (!header->array[j]) { + continue; + } + len += strlen(header->array[j]); } if (len) {