Browse code

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.

Nicolas C authored on 22/01/2021 14:16:56
Showing 1 changed files
... ...
@@ -454,6 +454,8 @@ static int xavp_rm_internal(str *name, sr_xavp_t **head, int idx)
454 454
 				if(idx>=0)
455 455
 					return 1;
456 456
 				count++;
457
+			} else {
458
+				prv = foo;
457 459
 			}
458 460
 			n++;
459 461
 		} else {
... ...
@@ -1914,6 +1916,8 @@ static int xavi_rm_internal(str *name, sr_xavp_t **head, int idx)
1914 1916
 				if(idx>=0)
1915 1917
 					return 1;
1916 1918
 				count++;
1919
+			} else {
1920
+				prv = foo;
1917 1921
 			}
1918 1922
 			n++;
1919 1923
 		} else {