[sr-dev] git:5.5:baea325a: core: ut - fixed str_casesearch()

Daniel-Constantin Mierla miconda at gmail.com
Wed May 26 08:16:04 CEST 2021


Module: kamailio
Branch: 5.5
Commit: baea325ab832a9f96e70c41f3aa542b7b99553fe
URL: https://github.com/kamailio/kamailio/commit/baea325ab832a9f96e70c41f3aa542b7b99553fe

Author: Boris Korzun <korzun at miatel.ru>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-05-26T08:14:42+02:00

core: ut - fixed str_casesearch()
- fixed str_casesearch() behaviour on text and needle were equal

(cherry picked from commit c146ef490e1d7d35add7d3ee593f6d3d20e327ad)

---

Modified: src/core/ut.c

---

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

---

diff --git a/src/core/ut.c b/src/core/ut.c
index 08edd2f24e..c3849fcc24 100644
--- a/src/core/ut.c
+++ b/src/core/ut.c
@@ -327,7 +327,7 @@ char *stre_search_strz(char *vstart, char *vend, char *needlez)
 char *str_casesearch(str *text, str *needle)
 {
 	int i,j;
-	for(i=0;i<text->len-needle->len;i++) {
+	for(i=0;i<=text->len-needle->len;i++) {
 		for(j=0;j<needle->len;j++) {
 			if ( !((text->s[i+j]==needle->s[j]) ||
 					( isalpha((int)text->s[i+j])
@@ -337,7 +337,7 @@ char *str_casesearch(str *text, str *needle)
 		if (j==needle->len)
 			return text->s+i;
 	}
-	return 0;
+	return NULL;
 }
 
 /**




More information about the sr-dev mailing list