[sr-dev] git:master:4068ddd3: rls: avoid access to item after free

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 31 08:22:50 CEST 2017


Module: kamailio
Branch: master
Commit: 4068ddd3ca01795e5378a738756b2735508f5864
URL: https://github.com/kamailio/kamailio/commit/4068ddd3ca01795e5378a738756b2735508f5864

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-31T08:20:08+02:00

rls: avoid access to item after free

---

Modified: src/modules/rls/list.h

---

Diff:  https://github.com/kamailio/kamailio/commit/4068ddd3ca01795e5378a738756b2735508f5864.diff
Patch: https://github.com/kamailio/kamailio/commit/4068ddd3ca01795e5378a738756b2735508f5864.patch

---

diff --git a/src/modules/rls/list.h b/src/modules/rls/list.h
index 6958ad6d9b..d2ed3f2c9e 100644
--- a/src/modules/rls/list.h
+++ b/src/modules/rls/list.h
@@ -105,14 +105,13 @@ static inline list_entry_t *list_remove(str strng, list_entry_t *list)
 	{
 		if (strncmp(p->strng->s, strng.s, strng.len) == 0)
 		{
+			list = list->next;
 			pkg_free(p->strng->s);
 			pkg_free(p->strng);
 			pkg_free(p);
-			return list->next;
-		}
-		else
-		{
-			list_entry_t *p = list, *q;
+			return list;
+		} else {
+			list_entry_t *q;
 
 			while (p->next != NULL && (cmp = strncmp(p->next->strng->s, strng.s, strng.len)) < 0)
 				p = p->next;




More information about the sr-dev mailing list