diff options
author | Michael Hanselmann <public@hansmi.ch> | 2021-05-29 17:29:44 +0200 |
---|---|---|
committer | Victor Toso <me@victortoso.com> | 2021-06-01 20:58:07 +0000 |
commit | c243c7244c06cb31d77b1c373726d9798a0c39f9 (patch) | |
tree | bc8c960152a0671d7a8e5548b85a305ed5462b73 | |
parent | dc26377dff414e4f0b7194c19eb71cd1251a97d1 (diff) |
fuzzing: Read complete source buffer on write
By reading the whole buffer an instrumented build can detect potential buffer
overflows on writing to a network connection.
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
-rw-r--r-- | fuzzing/usbredirparserfuzz.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fuzzing/usbredirparserfuzz.cc b/fuzzing/usbredirparserfuzz.cc index 7bd0e02..d163f8d 100644 --- a/fuzzing/usbredirparserfuzz.cc +++ b/fuzzing/usbredirparserfuzz.cc @@ -77,6 +77,11 @@ int parser_write(void *priv, uint8_t *data, int count) { log("%s: %d bytes\n", __func__, count); + // Read over complete source buffer to detect buffer overflows on write + void *buf = malloc(count); + memcpy(buf, data, count); + free(buf); + return count; } |