diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-10-19 15:27:40 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-10-21 16:48:12 -0500 |
commit | b271d4a28a607341f2374b6f8200b7f4f775e5e6 (patch) | |
tree | a829b93638d591c0c636094587190051791149c9 /main | |
parent | 04030b0dd09421d633f662d7c82efe0c3b554856 (diff) |
Add missing failure checks to ast_str_set_va() callers.
Change-Id: I0c2cdcd53727bdc6634095c61294807255bd278f
Diffstat (limited to 'main')
-rw-r--r-- | main/manager.c | 12 | ||||
-rw-r--r-- | main/xmldoc.c | 6 |
2 files changed, 15 insertions, 3 deletions
diff --git a/main/manager.c b/main/manager.c index 75b1d4d48..8295303c7 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2811,6 +2811,7 @@ AST_THREADSTORAGE(userevent_buf); */ void astman_append(struct mansession *s, const char *fmt, ...) { + int res; va_list ap; struct ast_str *buf; @@ -2819,8 +2820,11 @@ void astman_append(struct mansession *s, const char *fmt, ...) } va_start(ap, fmt); - ast_str_set_va(&buf, 0, fmt, ap); + res = ast_str_set_va(&buf, 0, fmt, ap); va_end(ap); + if (res == AST_DYNSTR_BUILD_FAILED) { + return; + } if (s->f != NULL || s->session->f != NULL) { send_string(s, ast_str_buffer(buf)); @@ -2880,6 +2884,7 @@ void astman_send_error(struct mansession *s, const struct message *m, char *erro void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt, ...) { + int res; va_list ap; struct ast_str *buf; char *msg; @@ -2889,8 +2894,11 @@ void astman_send_error_va(struct mansession *s, const struct message *m, const c } va_start(ap, fmt); - ast_str_set_va(&buf, 0, fmt, ap); + res = ast_str_set_va(&buf, 0, fmt, ap); va_end(ap); + if (res == AST_DYNSTR_BUILD_FAILED) { + return; + } /* astman_append will use the same underlying buffer, so copy the message out * before sending the response */ diff --git a/main/xmldoc.c b/main/xmldoc.c index fcf1b2cac..1a04e8168 100644 --- a/main/xmldoc.c +++ b/main/xmldoc.c @@ -2646,14 +2646,18 @@ struct ast_xml_xpath_results *__attribute__((format(printf, 1, 2))) ast_xmldoc_q struct documentation_tree *doctree; RAII_VAR(struct ast_str *, xpath_str, ast_str_create(128), ast_free); va_list ap; + int res; if (!xpath_str) { return NULL; } va_start(ap, fmt); - ast_str_set_va(&xpath_str, 0, fmt, ap); + res = ast_str_set_va(&xpath_str, 0, fmt, ap); va_end(ap); + if (res == AST_DYNSTR_BUILD_FAILED) { + return NULL; + } AST_RWLIST_RDLOCK(&xmldoc_tree); AST_LIST_TRAVERSE(&xmldoc_tree, doctree, entry) { |