Browse code

core: safety check for server_header lenght

- don't add the header in local generated replies if the value is empty

Daniel-Constantin Mierla authored on 10/10/2014 10:19:29
Showing 1 changed files
... ...
@@ -2398,7 +2398,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2398 2398
 			body = lump;
2399 2399
 	}
2400 2400
 	/* server header */
2401
-	if (server_signature)
2401
+	if (server_signature && server_hdr.len)
2402 2402
 		len += server_hdr.len + CRLF_LEN;
2403 2403
 	/* warning hdr */
2404 2404
 	if (sip_warning) {
... ...
@@ -2536,7 +2536,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2536 2536
 			p += lump->text.len;
2537 2537
 		}
2538 2538
 	/* server header */
2539
-	if (server_signature) {
2539
+	if (server_signature && server_hdr.len>0) {
2540 2540
 		memcpy( p, server_hdr.s, server_hdr.len );
2541 2541
 		p+=server_hdr.len;
2542 2542
 		memcpy( p, CRLF, CRLF_LEN );