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

@ -109,3 +109,34 @@ char *hal_strchr(const char *s, int c) {
}
return NULL;
}
char *hal_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;
}