]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix events with large bodies
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 3 Feb 2007 17:06:57 +0000 (17:06 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 3 Feb 2007 17:06:57 +0000 (17:06 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4113 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_event.c

index 36b535a6bec2b6c221b7b5fd076981f91cd3b717..7cfde415bc69e3ba0f9ea717cf3d9c0701dffdad 100644 (file)
@@ -519,19 +519,24 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, s
 SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, char *fmt, ...)
 {
        int ret = 0;
-       char data[2048];
+       char *data;
 
        va_list ap;
        if (fmt) {
                va_start(ap, fmt);
-               ret = vsnprintf(data, sizeof(data), fmt, ap);
+#ifdef HAVE_VASPRINTF
+               ret = vasprintf(&data, fmt, ap);
+#else
+               data = (char *) malloc(2048);
+               ret = vsnprintf(data, 2048, fmt, ap);
+#endif
                va_end(ap);
        }
 
        if (ret == -1) {
                return SWITCH_STATUS_GENERR;
        } else {
-               event->body = DUP(data);
+               event->body = data;
                return SWITCH_STATUS_SUCCESS;
        }
 }