]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't use uninitialized value of data, return error if null fmt string passed.
authorMichael Jerris <mike@jerris.com>
Sun, 4 Feb 2007 19:12:14 +0000 (19:12 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 4 Feb 2007 19:12:14 +0000 (19:12 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4116 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_event.c

index 7cfde415bc69e3ba0f9ea717cf3d9c0701dffdad..b81359601b897bb004eb54001577b3070a7b0cf8 100644 (file)
@@ -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;
        }
 }