mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-27 15:01:03 +08:00
access only when parsing is valid
This commit is contained in:
parent
1b9b8e3f6c
commit
dc0f9aca4a
@ -21,7 +21,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
mg_dns_parse(NULL, 0, &dm);
|
||||
|
||||
struct mg_http_message hm;
|
||||
mg_http_parse((const char *) data, size, &hm);
|
||||
if (mg_http_parse((const char *) data, size, &hm) > 0) {
|
||||
mg_crc32(0, hm.method.ptr, hm.method.len);
|
||||
mg_crc32(0, hm.uri.ptr, hm.uri.len);
|
||||
mg_crc32(0, hm.uri.ptr, hm.uri.len);
|
||||
@ -30,6 +30,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
mg_crc32(0, k->ptr, k->len);
|
||||
mg_crc32(0, v->ptr, v->len);
|
||||
}
|
||||
}
|
||||
mg_http_parse(NULL, 0, &hm);
|
||||
|
||||
struct mg_str body = mg_str_n((const char *) data, size);
|
||||
@ -41,15 +42,17 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
mg_url_decode(NULL, 0, tmp, 1, 1);
|
||||
|
||||
struct mg_mqtt_message mm;
|
||||
mg_mqtt_parse(data, size, 0, &mm);
|
||||
if (mg_mqtt_parse(data, size, 0, &mm) == MQTT_OK) {
|
||||
mg_crc32(0, mm.topic.ptr, mm.topic.len);
|
||||
mg_crc32(0, mm.data.ptr, mm.data.len);
|
||||
mg_crc32(0, mm.dgram.ptr, mm.dgram.len);
|
||||
}
|
||||
mg_mqtt_parse(NULL, 0, 0, &mm);
|
||||
mg_mqtt_parse(data, size, 5, &mm);
|
||||
if (mg_mqtt_parse(data, size, 5, &mm) == MQTT_OK) {
|
||||
mg_crc32(0, mm.topic.ptr, mm.topic.len);
|
||||
mg_crc32(0, mm.data.ptr, mm.data.len);
|
||||
mg_crc32(0, mm.dgram.ptr, mm.dgram.len);
|
||||
}
|
||||
mg_mqtt_parse(NULL, 0, 5, &mm);
|
||||
|
||||
mg_sntp_parse(data, size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user