[sr-dev] git:master:c146ef49: core: ut - fixed str_casesearch()

Daniel-Constantin Mierla miconda at gmail.com
Tue May 25 19:11:40 CEST 2021


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

Author: Boris Korzun <korzun at miatel.ru>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-05-25T19:11:35+02:00

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

---

Modified: src/core/ut.c

---

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

---

diff --git a/src/core/ut.c b/src/core/ut.c
index 65143b3e9d..00254eba23 100644
--- a/src/core/ut.c
+++ b/src/core/ut.c
@@ -353,7 +353,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])
@@ -363,7 +363,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