mirror of
https://gittea.dev/nova/th.git
synced 2025-10-25 04:10:15 -04:00
fixed missing 0 termination in smartcasestr
This commit is contained in:
@@ -9,7 +9,7 @@ char* concat(const char *s1, const char *s2){
|
||||
memcpy(result + len1, s2, len2 + 1);
|
||||
return result;
|
||||
}
|
||||
char* smartstrcasestr(char *haystack, const char *needle){
|
||||
char* smartstrcasestr(const char *haystack, const char *needle){
|
||||
char smart = 0;
|
||||
char *ret;
|
||||
char passes = 0;
|
||||
@@ -24,7 +24,7 @@ char* smartstrcasestr(char *haystack, const char *needle){
|
||||
needle -= passes;
|
||||
if (smart == 0) {
|
||||
char *needle_case = malloc(strlen(needle)+1);
|
||||
memcpy(needle_case, needle, strlen(needle));
|
||||
memcpy(needle_case, needle, strlen(needle)+1);
|
||||
passes = 0;
|
||||
while (*needle_case) {
|
||||
*needle_case = *needle_case | ' ';
|
||||
@@ -34,7 +34,7 @@ char* smartstrcasestr(char *haystack, const char *needle){
|
||||
needle_case -= passes;
|
||||
|
||||
char *haystack_case = malloc(strlen(haystack)+1);
|
||||
memcpy(haystack_case, haystack, strlen(haystack));
|
||||
memcpy(haystack_case, haystack, strlen(haystack)+1);
|
||||
passes = 0;
|
||||
while (*haystack_case) {
|
||||
*haystack_case = *haystack_case | ' ';
|
||||
|
||||
Reference in New Issue
Block a user