[Asterisk-code-review] Add missing failure checks to ast str set va() callers. (asterisk[master])
Richard Mudgett
asteriskteam at digium.com
Wed Oct 21 17:04:26 CDT 2015
Richard Mudgett has uploaded a new change for review.
https://gerrit.asterisk.org/1479
Change subject: Add missing failure checks to ast_str_set_va() callers.
......................................................................
Add missing failure checks to ast_str_set_va() callers.
Change-Id: I0c2cdcd53727bdc6634095c61294807255bd278f
---
M main/manager.c
M main/xmldoc.c
2 files changed, 15 insertions(+), 3 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/79/1479/1
diff --git a/main/manager.c b/main/manager.c
index 2ea6fae..6e9ae00 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -2819,6 +2819,7 @@
*/
void astman_append(struct mansession *s, const char *fmt, ...)
{
+ int res;
va_list ap;
struct ast_str *buf;
@@ -2827,8 +2828,11 @@
}
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));
@@ -2888,6 +2892,7 @@
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;
@@ -2897,8 +2902,11 @@
}
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 399a7be..86c3f65 100644
--- a/main/xmldoc.c
+++ b/main/xmldoc.c
@@ -2646,14 +2646,18 @@
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) {
--
To view, visit https://gerrit.asterisk.org/1479
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c2cdcd53727bdc6634095c61294807255bd278f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-code-review
mailing list