mirror of
https://github.com/clearml/dropbear
synced 2025-06-16 19:28:49 +00:00
fix uninitialised memory in fuzzer codepath
This commit is contained in:
parent
a60725740b
commit
4fd3160179
8
packet.c
8
packet.c
@ -364,9 +364,11 @@ static int checkmac() {
|
|||||||
|
|
||||||
#if DROPBEAR_FUZZ
|
#if DROPBEAR_FUZZ
|
||||||
if (fuzz.fuzzing) {
|
if (fuzz.fuzzing) {
|
||||||
/* fail 1 in 2000 times to test error path.
|
/* fail 1 in 2000 times to test error path. */
|
||||||
note that mac_bytes is all zero prior to kex, so don't test ==0 ! */
|
unsigned int value = 0;
|
||||||
unsigned int value = *((unsigned int*)&mac_bytes);
|
if (mac_size > sizeof(value)) {
|
||||||
|
memcpy(&value, mac_bytes, sizeof(value));
|
||||||
|
}
|
||||||
if (value % 2000 == 99) {
|
if (value % 2000 == 99) {
|
||||||
return DROPBEAR_FAILURE;
|
return DROPBEAR_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user