diff --git a/client/src/util.c b/client/src/util.c index 133f639ee..b6ddd046c 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -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--) { diff --git a/tools/hitag2crack/crack2/ht2crack2buildtable.c b/tools/hitag2crack/crack2/ht2crack2buildtable.c index 625a0f175..6533e3934 100644 --- a/tools/hitag2crack/crack2/ht2crack2buildtable.c +++ b/tools/hitag2crack/crack2/ht2crack2buildtable.c @@ -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); }