From: Mark Michelson Date: Fri, 28 Mar 2008 19:14:51 +0000 (+0000) Subject: Temporary revert of 111662. It's causing lots of trouble and appears to not be X-Git-Tag: 1.6.2.0-beta1~2591 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a0f4cc933283293a5b19eb11730eb3328f81052;p=thirdparty%2Fasterisk.git Temporary revert of 111662. It's causing lots of trouble and appears to not be the proper solution to the problem reported anyway. (related to issue #12884) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111777 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6c7478ceb1..fc176db022 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -8308,15 +8308,15 @@ static void copy_request(struct sip_request *dst, const struct sip_request *src) if (!dst->data && !(dst->data = ast_str_create(src->data->used))) return; else if (dst->data->len < src->data->used) - ast_str_make_space(&dst->data, src->data->used + 1); /* Account for null terminator needed */ + ast_str_make_space(&dst->data, src->data->used); - ast_copy_string(dst->data->str, src->data->str, dst->data->len); + memcpy(dst->data->str, src->data->str, src->data->used); dst->data->used = src->data->used; offset = ((void *)dst->data->str) - ((void *)src->data->str); /* Now fix pointer arithmetic */ - for (x = 0; x < src->headers; x++) + for (x=0; x < src->headers; x++) dst->header[x] += offset; - for (x = 0; x < src->lines; x++) + for (x=0; x < src->lines; x++) dst->line[x] += offset; /* On some occasions this function is called without parse_request being called first so lets not create an invalid pointer */ if (src->rlPart1) diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index fbff083abd..226c7bb67e 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -326,7 +326,7 @@ int ast_get_timeval(const char *src, struct timeval *tv, struct timeval _default */ struct ast_str { size_t len; /*!< The current maximum length of the string */ - size_t used; /*!< Amount of space used. Does not include string's null terminator */ + size_t used; /*!< Amount of space used */ struct ast_threadstorage *ts; /*!< What kind of storage is this ? */ #define DS_MALLOC ((struct ast_threadstorage *)1) #define DS_ALLOCA ((struct ast_threadstorage *)2)