aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-19 20:08:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-19 20:08:06 +0000
commit4bb847d898b786a3f62cc68781a5a890156d371c (patch)
treea37071b9d5646eccabccfc1164f53ccb0f047d57 /main
parent1549bc47745747b74868d673a3a4f8fd4d32ac20 (diff)
Merged revisions 169365 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r169365 | tilghman | 2009-01-19 14:05:52 -0600 (Mon, 19 Jan 2009) | 11 lines Merged revisions 169364 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r169364 | tilghman | 2009-01-19 13:49:25 -0600 (Mon, 19 Jan 2009) | 4 lines Truncate userevents at the end of a line, when the command exceeds the buffer. (closes issue #14278) Reported by: fnordian ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@169366 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/manager.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/main/manager.c b/main/manager.c
index 2e130e562..ad3fd1977 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -870,6 +870,8 @@ static int send_string(struct mansession *s, char *string)
* initialize the thread local storage key.
*/
AST_THREADSTORAGE(astman_append_buf);
+AST_THREADSTORAGE(userevent_buf);
+
/*! \brief initial allocated size for the astman_append_buf */
#define ASTMAN_APPEND_BUF_INITSIZE 256
@@ -2405,18 +2407,15 @@ static char mandescr_userevent[] =
static int action_userevent(struct mansession *s, const struct message *m)
{
const char *event = astman_get_header(m, "UserEvent");
- char body[2048] = "";
- int x, bodylen = 0;
+ struct ast_str *body = ast_str_thread_get(&userevent_buf, 16);
+ int x;
for (x = 0; x < m->hdrcount; x++) {
if (strncasecmp("UserEvent:", m->headers[x], strlen("UserEvent:"))) {
- ast_copy_string(body + bodylen, m->headers[x], sizeof(body) - bodylen - 3);
- bodylen += strlen(m->headers[x]);
- ast_copy_string(body + bodylen, "\r\n", 3);
- bodylen += 2;
+ ast_str_append(&body, 0, "%s\r\n", m->headers[x]);
}
}
- manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s", event, body);
+ manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s", event, body->str);
return 0;
}