mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-23 20:11:49 +00:00
Fuzzing MIP
This commit is contained in:
1 parent
ec79ca71b2
commit
a12bd2271e
11 files changed
+211
-101
No files matched your search
+20
-1
@@ -1,8 +1,15 @@
|
||||
#define MG_ENABLE_SOCKET 0
|
||||
#define MG_ENABLE_MIP 1
|
||||
#define MG_ENABLE_PACKED_FS 0
|
||||
|
||||
#include <assert.h>
|
||||
#include "mongoose.c"
|
||||
|
||||
#include "driver_mock.c"
|
||||
|
||||
static void test_queue(void) {
|
||||
static uint8_t buf[sizeof(size_t) + sizeof(uint16_t) + 3 ]; // fit 1 element but not 2
|
||||
static uint8_t
|
||||
buf[sizeof(size_t) + sizeof(uint16_t) + 3]; // fit 1 element but not 2
|
||||
uint16_t val = 1234;
|
||||
static struct queue q = {buf, sizeof(buf), 0, 0};
|
||||
|
||||
@@ -30,8 +37,20 @@ static void test_queue(void) {
|
||||
assert(q_avail(&q) == 0);
|
||||
}
|
||||
|
||||
static void test_statechange(void) {
|
||||
uint8_t tx[1540];
|
||||
struct mip_if iface;
|
||||
memset(&iface, 0, sizeof(iface));
|
||||
iface.ip = mg_htonl(0x01020304);
|
||||
iface.state = MIP_STATE_READY;
|
||||
iface.tx.buf = tx, iface.tx.len = sizeof(tx);
|
||||
iface.driver = &mip_driver_mock;
|
||||
onstatechange(&iface);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
test_queue();
|
||||
test_statechange();
|
||||
printf("SUCCESS\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user