diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-15 21:00:58 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-15 21:00:58 +0000 |
commit | b0bc4317224e4287a4a362097df173899fc1a5af (patch) | |
tree | 7b1ae63e84abef3b9dbf797124ec6112cfa2e93f /channels | |
parent | aeb6b55d5e846a8864c38d94e61e9539a7527b31 (diff) |
Merged revisions 175829 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r175829 | russell | 2009-02-15 14:56:27 -0600 (Sun, 15 Feb 2009) | 14 lines
Fix a number of problems with ast_sched_report().
1) It had numerous coding guidelines violations with regards to formatting.
2) It allocated memory using ast_calloc() that was never freed.
3) It didn't check for failure from the allocation.
4) It used sprintf() and strcat() to build the result, doing zero checking to
prevent writing past the end of the provided buffer.
The function also lacks API documentation, but that has not been addressed in
this commit.
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@175831 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index ef7c4e001..1fb775179 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -13821,7 +13821,7 @@ static char *sip_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args static char *sip_show_sched(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char cbuf[2256]; + struct ast_str *cbuf; struct ast_cb_names cbnames = {9, { "retrans_pkt", "__sip_autodestruct", "expire_register", @@ -13851,9 +13851,13 @@ static char *sip_show_sched(struct ast_cli_entry *e, int cmd, struct ast_cli_arg case CLI_GENERATE: return NULL; } + + cbuf = ast_str_alloca(2048); + ast_cli(a->fd, "\n"); - ast_sched_report(sched, cbuf, sizeof(cbuf), &cbnames); - ast_cli(a->fd, "%s", cbuf); + ast_sched_report(sched, &cbuf, &cbnames); + ast_cli(a->fd, "%s", cbuf->str); + return CLI_SUCCESS; } |