[sr-dev] git:master:12414972: core: fix to xavp_rm_internal (#2604)

Nicolas C nchaigne at capgemini.fr
Mon Jan 25 10:40:20 CET 2021


Module: kamailio
Branch: master
Commit: 12414972ad0c28ac50ece3c14f98134c3f06c522
URL: https://github.com/kamailio/kamailio/commit/12414972ad0c28ac50ece3c14f98134c3f06c522

Author: Nicolas C <nchaigne at capgemini.fr>
Committer: Nicolas C <nchaigne at capgemini.fr>
Date: 2021-01-22T16:04:40+01:00

core: fix to xavp_rm_internal (#2604)

This fixes the following issue:
https://github.com/kamailio/kamailio/issues/2604

Description of the issue:

When called to remove a specific index from a given xavp, function xavp_rm_by_index removes the index (as expected) but also all others before it.

E.g :
If called with idx = 1, it removes indexes 0 and 1.
Likewise if invoked with idx = 2 => the first 3 elements are removed.

This bug is located in function xavp_rm_internal. An assignment was missing when looping over the xavp list.
Same for xavi_rm_internal.

---

Modified: src/core/xavp.c

---

Diff:  https://github.com/kamailio/kamailio/commit/12414972ad0c28ac50ece3c14f98134c3f06c522.diff
Patch: https://github.com/kamailio/kamailio/commit/12414972ad0c28ac50ece3c14f98134c3f06c522.patch

---

diff --git a/src/core/xavp.c b/src/core/xavp.c
index de6da0c858..26e89a8df3 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -454,6 +454,8 @@ static int xavp_rm_internal(str *name, sr_xavp_t **head, int idx)
 				if(idx>=0)
 					return 1;
 				count++;
+			} else {
+				prv = foo;
 			}
 			n++;
 		} else {
@@ -1914,6 +1916,8 @@ static int xavi_rm_internal(str *name, sr_xavp_t **head, int idx)
 				if(idx>=0)
 					return 1;
 				count++;
+			} else {
+				prv = foo;
 			}
 			n++;
 		} else {




More information about the sr-dev mailing list