mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-14 09:48:01 +08:00
Fuzzer nits
This commit is contained in:
parent
ce8fa4c24b
commit
2e14d125ba
@ -67,7 +67,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
if_init(ifp, &mgr, &cfg, &mip_driver_mock, NULL, pktlen, 0);
|
if_init(ifp, &mgr, &cfg, &mip_driver_mock, NULL, pktlen, 0);
|
||||||
|
|
||||||
// Make a copy of the random data, in order to modify it
|
// Make a copy of the random data, in order to modify it
|
||||||
uint8_t *pkt = malloc(size);
|
void *pkt = malloc(size);
|
||||||
struct eth *eth = (struct eth *) pkt;
|
struct eth *eth = (struct eth *) pkt;
|
||||||
memcpy(pkt, data, size);
|
memcpy(pkt, data, size);
|
||||||
if (size > sizeof(*eth)) {
|
if (size > sizeof(*eth)) {
|
||||||
@ -78,7 +78,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
if (i >= sizeof(eth_types) / sizeof(eth_types[0])) i = 0;
|
if (i >= sizeof(eth_types) / sizeof(eth_types[0])) i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mip_rx(ifp, (void *) pkt, size);
|
mip_rx(ifp, pkt, size);
|
||||||
mgr.priv = NULL; // Don't let Mongoose free() ifp
|
mgr.priv = NULL; // Don't let Mongoose free() ifp
|
||||||
mg_mgr_free(&mgr);
|
mg_mgr_free(&mgr);
|
||||||
free(pkt);
|
free(pkt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user