From 19272dc5e230fb3d7e8ede258028f00a6d71459d Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 12 Dec 2014 10:25:42 -0600 Subject: [PATCH] FS-7078: fix sip_header_as_string to properly null_terminate on larger header strings --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index d3d7dac4b3..43989408cc 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Nov 12 13:07:56 CST 2014 +Fri Dec 12 10:24:52 CST 2014 diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c index a2880df520..555e8a151a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c @@ -394,7 +394,7 @@ issize_t sip_header_field_e(char *b, isize_t bsiz, sip_header_t const *h, int fl char *sip_header_as_string(su_home_t *home, sip_header_t const *h) { ssize_t len; - char *rv, s[128]; + char *rv, s[256]; if (h == NULL) return NULL; @@ -412,6 +412,7 @@ char *sip_header_as_string(su_home_t *home, sip_header_t const *h) for (rv = su_alloc(home, len); rv; rv = su_realloc(home, rv, len)) { + memset(rv,0,len); ssize_t n = sip_header_field_e(rv, len, h, 0); if (n > -1 && n + 1 <= len) break;