Fix overflow in rx_icmp

This commit is contained in:
cpq committed 2022-09-29 16:53:11 +01:00
1 parent a88a11c243
commit 9680b8ccb3
6 files changed
+34 -18

No files matched your search

+13 -1
View File
@@ -58,7 +58,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
mg_json_get(mg_str_n((char *) data, size), "$[0]", &n);
if (size > 0) {
struct mip_cfg cfg = {};
struct mip_cfg cfg = {0};
size_t pktlen = 1540;
char t[sizeof(struct mip_if) + pktlen * 2 + 0 /* qlen */];
struct mip_if *ifp = (struct mip_if *) t;
@@ -85,3 +85,15 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
return 0;
}
#if defined(MAIN)
int main(int argc, char *argv[]) {
if (argc > 1) {
size_t len = 0;
char *buf = mg_file_read(&mg_fs_posix, argv[1], &len);
if (buf != NULL) LLVMFuzzerTestOneInput((uint8_t *) buf, len);
free(buf);
}
return 0;
}
#endif