]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add missing failure checks to ast_str_set_va() callers. 81/1481/1
authorRichard Mudgett <rmudgett@digium.com>
Mon, 19 Oct 2015 20:27:40 +0000 (15:27 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 21 Oct 2015 22:04:50 +0000 (17:04 -0500)
Change-Id: I0c2cdcd53727bdc6634095c61294807255bd278f

main/manager.c
main/xmldoc.c

index 9f3331a9994f48960da89cfd0d13c18ef7899513..3e98af2c5a8d2b7bb8798d8d27ef7abd9f835f73 100644 (file)
@@ -2809,6 +2809,7 @@ AST_THREADSTORAGE(userevent_buf);
  */
 void astman_append(struct mansession *s, const char *fmt, ...)
 {
+       int res;
        va_list ap;
        struct ast_str *buf;
 
@@ -2817,8 +2818,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));
@@ -2878,6 +2882,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;
@@ -2887,8 +2892,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 */
index 0374aeff352f7a19451bc50eeafc3a177d3d7a9f..f48d203fc99792c244afaa20507dc2af3d3190d9 100644 (file)
@@ -2643,14 +2643,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) {