diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-07-02 14:51:29 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-07-06 15:38:15 -0500 |
commit | 0422433f4722e6e692b0c84342e048feff344e80 (patch) | |
tree | eec3637cf632b5f87a640f989df3b9e361b2529c /res/res_pjsip_pubsub.c | |
parent | 8ea214aed782424a884b9a2f67d6dca270854e83 (diff) |
PJSIP XML, XPIDF: Fix buffer size overwrite memory corruption error.
When res_pjsip body generator modules were generating XML or XPIDF
response bodies, there was a chance that the generated body would be the
exact size of the supplied buffer. Adding the nul string terminator would
then write beyond the end of the buffer and potentially corrupt memory.
* Fix MALLOC_DEBUG high fence violations caused by adding a nul string
terminator on the end of a buffer for XML or XPIDF response bodies.
* Made calls to pj_xml_print() safer if the XML prolog is requested. Due
to a bug in pjproject, the return value could be -1 _or_
AST_PJSIP_XML_PROLOG_LEN if the supplied buffer is not large enough.
* Updated the doxygen comment of AST_PJSIP_XML_PROLOG_LEN to describe the
return value of pj_xml_print() when the supplied buffer is not large
enough.
ASTERISK-25168
Reported by: Carl Fortin
Change-Id: Id70e1d373a6a2b2bd9e678b5cbc5e55b308981de
Diffstat (limited to 'res/res_pjsip_pubsub.c')
-rw-r--r-- | res/res_pjsip_pubsub.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index c00bc76ee..650f5c5c8 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -1769,7 +1769,7 @@ static int rlmi_print_body(struct pjsip_msg_body *msg_body, char *buf, pj_size_t pj_xml_node *rlmi = msg_body->data; num_printed = pj_xml_print(rlmi, buf, size, PJ_TRUE); - if (num_printed == AST_PJSIP_XML_PROLOG_LEN) { + if (num_printed <= AST_PJSIP_XML_PROLOG_LEN) { return -1; } |