... | ... |
@@ -889,11 +889,12 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text , |
889 | 889 |
char *warning; |
890 | 890 |
unsigned int warning_len; |
891 | 891 |
unsigned int text_len; |
892 |
- int r; |
|
893 |
- int content_len_len; |
|
892 |
+ int r; |
|
893 |
+ int content_len_len; |
|
894 | 894 |
char *content_len; |
895 |
+ char content_len_buf[MAX_CONTENT_LEN_BUF]; |
|
895 | 896 |
char *after_body; |
896 |
- str to_tag; |
|
897 |
+ str to_tag; |
|
897 | 898 |
char *totags; |
898 | 899 |
|
899 | 900 |
received_buf=0; |
... | ... |
@@ -988,8 +989,10 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text , |
988 | 989 |
|
989 | 990 |
if (body_len) { |
990 | 991 |
content_len=int2str(body_len, &content_len_len); |
992 |
+ memcpy(content_len_buf,content_len,content_len_len+1); |
|
993 |
+ content_len = content_len_buf; |
|
991 | 994 |
len += CONTENT_LENGTH_LEN + content_len_len + CRLF_LEN; |
992 |
- len += body_len; |
|
995 |
+ len += body_len; |
|
993 | 996 |
} else { |
994 | 997 |
len +=CONTENT_LENGTH_LEN+1 + CRLF_LEN; |
995 | 998 |
} |
... | ... |
@@ -148,11 +148,12 @@ static inline int btostr( char *p, unsigned char val) |
148 | 148 |
} |
149 | 149 |
|
150 | 150 |
|
151 |
+#define INT2STR_MAX_LEN 11 /* 10 digits + 0 */ |
|
151 | 152 |
|
152 | 153 |
/* returns a pointer to a static buffer containing l in asciiz & sets len */ |
153 | 154 |
static inline char* int2str(unsigned int l, int* len) |
154 | 155 |
{ |
155 |
- static char r[11]; /* 10 digits + 0 */ |
|
156 |
+ static char r[INT2STR_MAX_LEN]; |
|
156 | 157 |
int i; |
157 | 158 |
|
158 | 159 |
i=9; |