Only allow absolute paths

This commit is contained in:
2025-11-06 21:58:24 +01:00
parent f3fcc92991
commit 2fa77d073f
6 changed files with 91 additions and 0 deletions

View File

@ -282,3 +282,34 @@ void * string_memmove(void* dest, const void* src, unsigned int n)
}
return dest;
}
char *string_strstr(const char *str, const char *substring)
{
const char *a;
const char *b;
b = substring;
if (*b == 0) {
return (char *) str;
}
for ( ; *str != 0; str += 1) {
if (*str != *b) {
continue;
}
a = str;
while (1) {
if (*b == 0) {
return (char *) str;
}
if (*a++ != *b++) {
break;
}
}
b = substring;
}
return NULL;
}

View File

@ -20,6 +20,7 @@ char *string_tokenizealloc(char *s, char *delim);
char *string_tokenizealloc_linecontinue(char *s, char *delim);
char *string_combine(char *dest, const char *src);
void * string_memmove(void* dest, const void* src, unsigned int n);
char *string_strstr(const char *str, const char *substring);
#endif