MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / set_path_vector

Function set_path_vector

parser/msg_parser.c:1364–1393  ·  view source on GitHub ↗

* Make a private copy of the string and assign it to path_vec */

Source from the content-addressed store, hash-verified

1362 * Make a private copy of the string and assign it to path_vec
1363 */
1364int set_path_vector(struct sip_msg *msg, str *path)
1365{
1366 if (!msg || !path) {
1367 LM_ERR("invalid parameter value\n");
1368 return -1;
1369 }
1370
1371 /* strange/corrupt input: best to assume it's an empty URI */
1372 if (!path->s || path->len == 0) {
1373 pkg_free(msg->path_vec.s);
1374 memset(&msg->path_vec, 0, sizeof msg->path_vec);
1375 return 0;
1376 }
1377
1378 if (msg->path_vec.s && (msg->path_vec.len >= path->len)) {
1379 memcpy(msg->path_vec.s, path->s, path->len);
1380 msg->path_vec.len = path->len;
1381 } else {
1382 msg->path_vec.s = pkg_realloc(msg->path_vec.s, path->len);
1383 if (!msg->path_vec.s) {
1384 LM_ERR("not enough pkg memory\n");
1385 return -1;
1386 }
1387
1388 memcpy(msg->path_vec.s, path->s, path->len);
1389 msg->path_vec.len = path->len;
1390 }
1391
1392 return 0;
1393}
1394
1395void clear_path_vector(struct sip_msg *msg)
1396{

Callers 7

next_branchesFunction · 0.85
_branch_2_msgFunction · 0.85
ul_contact_event_to_msgFunction · 0.85
dst_to_msgFunction · 0.85
pack_ciFunction · 0.85
push_branchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected