- string termination issue in libosip2-2.2.0:
osip_message_to_str, osip_body_to_str
This commit is contained in:
@@ -967,6 +967,9 @@ int proxy_rewrite_invitation_body(osip_message_t *mymsg, int direction){
|
||||
}
|
||||
|
||||
sts = sip_body_to_str(body, &bodybuff);
|
||||
if (sts != 0) {
|
||||
ERROR("rewrite_invitation_body: unable to sip_body_to_str");
|
||||
}
|
||||
sts = sdp_message_init(&sdp);
|
||||
sts = sdp_message_parse (sdp, bodybuff);
|
||||
osip_free(bodybuff);
|
||||
@@ -1211,6 +1214,9 @@ if (configuration.debuglevel)
|
||||
|
||||
/* include new body */
|
||||
sip_message_set_body(mymsg, bodybuff);
|
||||
if (sts != 0) {
|
||||
ERROR("rewrite_invitation_body: unable to sip_message_set_body body");
|
||||
}
|
||||
|
||||
/* free content length resource and include new one*/
|
||||
osip_content_length_free(mymsg->content_length);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <osipparser2/osip_parser.h>
|
||||
#include <log.h>
|
||||
|
||||
static char const ident[]="$Id$";
|
||||
|
||||
@@ -39,8 +40,15 @@ int sip_message_parse(osip_message_t * sip, const char *buf) {
|
||||
|
||||
int sip_message_to_str(osip_message_t * sip, char **dest) {
|
||||
#ifdef HAVE_FUNC_OSIP_MESSAGE_TO_STR_3
|
||||
int sts;
|
||||
size_t len;
|
||||
return osip_message_to_str(sip, dest, &len);
|
||||
sts = osip_message_to_str(sip, dest, &len);
|
||||
/*
|
||||
* NULL termination (libosip2-2.2.0 does NOT do this properly,
|
||||
* there is always one byte too much :-( )
|
||||
*/
|
||||
(*dest)[len]='\0';
|
||||
return sts;
|
||||
#else
|
||||
return osip_message_to_str(sip, dest);
|
||||
#endif
|
||||
@@ -48,8 +56,15 @@ int sip_message_to_str(osip_message_t * sip, char **dest) {
|
||||
|
||||
int sip_body_to_str(const osip_body_t * body, char **dest) {
|
||||
#ifdef HAVE_FUNC_OSIP_BODY_TO_STR_3
|
||||
int sts;
|
||||
size_t len;
|
||||
return osip_body_to_str (body, dest, &len);
|
||||
sts = osip_body_to_str(body, dest, &len);
|
||||
/*
|
||||
* NULL termination (libosip2-2.2.0 does NOT do this properly,
|
||||
* there is always one byte too much :-( )
|
||||
*/
|
||||
(*dest)[len]='\0';
|
||||
return sts;
|
||||
#else
|
||||
return osip_body_to_str(body, &dest);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user