summaryrefslogtreecommitdiff
path: root/res/res_pjsip_dialog_info_body_generator.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_pjsip_dialog_info_body_generator.c')
-rw-r--r--res/res_pjsip_dialog_info_body_generator.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/res/res_pjsip_dialog_info_body_generator.c b/res/res_pjsip_dialog_info_body_generator.c
index d9725f4c5..48ac60f98 100644
--- a/res/res_pjsip_dialog_info_body_generator.c
+++ b/res/res_pjsip_dialog_info_body_generator.c
@@ -163,14 +163,13 @@ static void dialog_info_to_string(void *body, struct ast_str **str)
int size;
do {
- size = pj_xml_print(dialog_info, ast_str_buffer(*str), ast_str_size(*str), PJ_TRUE);
- if (size == AST_PJSIP_XML_PROLOG_LEN) {
+ size = pj_xml_print(dialog_info, ast_str_buffer(*str), ast_str_size(*str) - 1, PJ_TRUE);
+ if (size <= AST_PJSIP_XML_PROLOG_LEN) {
ast_str_make_space(str, ast_str_size(*str) * 2);
++growths;
}
- } while (size == AST_PJSIP_XML_PROLOG_LEN && growths < MAX_STRING_GROWTHS);
-
- if (size == AST_PJSIP_XML_PROLOG_LEN) {
+ } while (size <= AST_PJSIP_XML_PROLOG_LEN && growths < MAX_STRING_GROWTHS);
+ if (size <= AST_PJSIP_XML_PROLOG_LEN) {
ast_log(LOG_WARNING, "dialog-info+xml body text too large\n");
return;
}