Fix stack-based buffer overflow in "lf em 4x05 sniff" command

This commit is contained in:
Hanno Heinrichs committed 2022-12-29 13:55:24 +01:00
1 parent b43bb92961
commit 9e0fe3ca36
5 files changed
+54 -28

No files matched your search

+9
View File
@@ -1261,3 +1261,12 @@ int byte_strstr(uint8_t *src, size_t srclen, uint8_t *pattern, size_t plen) {
}
return -1;
}
void sb_append_char(smartbuf *sb, unsigned char c) {
if (sb->idx >= sb->size) {
sb->size *= 2;
sb->ptr = realloc(sb->ptr, sb->size);
}
sb->ptr[sb->idx] = c;
sb->idx++;
}