FS-7078: fix sip_header_as_string to properly null_terminate on larger header strings

This commit is contained in:
Michael Jerris 2014-12-12 10:25:42 -06:00 committed by Brian West
parent 39fa0b9664
commit 19272dc5e2
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
Wed Nov 12 13:07:56 CST 2014
Fri Dec 12 10:24:52 CST 2014

View File

@ -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;