Browse code

path: use memcpy() instead of strncpy()

- avoid gcc 8.2 warning: ‘strncpy’ output truncated before terminating nul

Daniel-Constantin Mierla authored on 20/09/2018 14:37:15
Showing 1 changed files
... ...
@@ -406,8 +406,8 @@ void path_rr_callback(struct sip_msg *_m, str *r_param, void *cb_param)
406 406
 		}
407 407
 	} else {
408 408
 		/* received=ip~port~proto */
409
-		strncpy(dst_uri_buf, "sip:", 4);
410
-		strncpy(dst_uri_buf+4, hooks.contact.received->body.s,
409
+		memcpy(dst_uri_buf, "sip:", 4);
410
+		memcpy(dst_uri_buf+4, hooks.contact.received->body.s,
411 411
 					hooks.contact.received->body.len);
412 412
 		dst_uri_buf[4+hooks.contact.received->body.len] = '\0';
413 413
 		p = dst_uri_buf + 4;
... ...
@@ -433,7 +433,7 @@ void path_rr_callback(struct sip_msg *_m, str *r_param, void *cb_param)
433 433
 							LM_ERR("unknown proto in received param\n");
434 434
 							goto done;
435 435
 						}
436
-						strncpy(p, "transport=", 10);
436
+						memcpy(p, "transport=", 10);
437 437
 						p += 10;
438 438
 						memcpy(p, sproto.s, sproto.len);
439 439
 						p += sproto.len;