2019-07-12 13:28:20 +01:00
|
|
|
#include "mongoose.h"
|
|
|
|
|
2020-12-05 11:26:32 +00:00
|
|
|
|
2019-07-12 13:28:20 +01:00
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
2020-12-05 11:26:32 +00:00
|
|
|
struct mg_dns_message dm;
|
|
|
|
mg_dns_parse(data, size, &dm);
|
2020-12-11 13:16:51 +00:00
|
|
|
mg_dns_parse(NULL, 0, &dm);
|
2020-12-05 11:26:32 +00:00
|
|
|
|
|
|
|
struct mg_http_message hm;
|
|
|
|
mg_http_parse((const char *) data, size, &hm);
|
2020-12-11 13:16:51 +00:00
|
|
|
mg_http_parse(NULL, 0, &hm);
|
2020-12-05 11:26:32 +00:00
|
|
|
|
2020-12-07 18:52:40 +00:00
|
|
|
struct mg_str body = mg_str_n((const char *) data, size);
|
|
|
|
char tmp[256];
|
|
|
|
mg_http_get_var(&body, "key", tmp, sizeof(tmp));
|
2020-12-13 16:33:46 +00:00
|
|
|
mg_http_get_var(&body, "key", NULL, 0);
|
2020-12-11 09:35:50 +00:00
|
|
|
mg_url_decode((char *) data, size, tmp, sizeof(tmp), 1);
|
|
|
|
mg_url_decode((char *) data, size, tmp, 1, 1);
|
2020-12-11 13:16:51 +00:00
|
|
|
mg_url_decode(NULL, 0, tmp, 1, 1);
|
2020-12-07 18:52:40 +00:00
|
|
|
|
2020-12-05 11:26:32 +00:00
|
|
|
struct mg_mqtt_message mm;
|
|
|
|
mg_mqtt_parse(data, size, &mm);
|
2020-12-11 13:16:51 +00:00
|
|
|
mg_mqtt_parse(NULL, 0, &mm);
|
2020-12-05 11:26:32 +00:00
|
|
|
|
|
|
|
struct timeval tv;
|
|
|
|
mg_sntp_parse(data, size, &tv);
|
2020-12-11 13:16:51 +00:00
|
|
|
mg_sntp_parse(NULL, 0, &tv);
|
2020-12-05 11:26:32 +00:00
|
|
|
|
2020-12-07 18:52:40 +00:00
|
|
|
char buf[size * 4 / 3 + 5]; // At least 4 chars and nul termination
|
|
|
|
mg_base64_decode((char *) data, size, buf);
|
2020-12-11 13:16:51 +00:00
|
|
|
mg_base64_decode(NULL, 0, buf);
|
2020-12-07 18:52:40 +00:00
|
|
|
mg_base64_encode(data, size, buf);
|
2020-12-11 13:16:51 +00:00
|
|
|
mg_base64_encode(NULL, 0, buf);
|
2020-12-07 18:52:40 +00:00
|
|
|
|
2019-07-12 13:28:20 +01:00
|
|
|
return 0;
|
|
|
|
}
|