From df7ce0d9513dcfd821c47bca115b7cbc9a22947a Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sun, 4 Feb 2007 19:12:14 +0000 Subject: [PATCH] don't use uninitialized value of data, return error if null fmt string passed. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4116 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_event.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/switch_event.c b/src/switch_event.c index 7cfde415bc..b81359601b 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -531,13 +531,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, cha ret = vsnprintf(data, 2048, fmt, ap); #endif va_end(ap); - } - if (ret == -1) { - return SWITCH_STATUS_GENERR; + if (ret == -1) { + return SWITCH_STATUS_GENERR; + } else { + event->body = data; + return SWITCH_STATUS_SUCCESS; + } } else { - event->body = data; - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_GENERR; } }