fix fct when called with a one byte array

This commit is contained in:
iceman1001 2025-08-29 13:55:50 +02:00
parent c3e29789a9
commit 7414cdf359
2 changed files with 5 additions and 1 deletions

View file

@ -1563,6 +1563,10 @@ int byte_strstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_
continue;
}
if (plen == 1) {
return i;
}
// try to match rest of the pattern
for (int j = plen - 1; j >= 1; j--) {

View file

@ -453,7 +453,7 @@ int main(int argc, char *argv[]) {
// make the table of tables
t = (struct table *)calloc(sizeof(struct table) * 65536, sizeof(uint8_t));
if (!t) {
if (t == NULL) {
printf("calloc failed\n");
exit(1);
}