mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 20:28:37 +08:00
flashparams: Fix a null-pointer dereference crash
Fix a potential crash caused by calling erase_sector with a null sector_descriptor (current_sector == 0). Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
committed by
David Sidrane
parent
58b40fbbb9
commit
b99e597a73
@@ -875,11 +875,13 @@ parameter_flashfs_write(flash_file_token_t token, uint8_t *buffer, size_t buf_si
|
|||||||
}
|
}
|
||||||
|
|
||||||
pf = (flash_entry_header_t *) current_sector->address;
|
pf = (flash_entry_header_t *) current_sector->address;
|
||||||
|
|
||||||
|
if (!blank_check(pf, total_size)) {
|
||||||
|
rv = erase_sector(current_sector, pf);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!blank_check(pf, total_size)) {
|
|
||||||
rv = erase_sector(current_sector, pf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flash_entry_header_t *pn = (flash_entry_header_t *)(buffer - sizeof(flash_entry_header_t));
|
flash_entry_header_t *pn = (flash_entry_header_t *)(buffer - sizeof(flash_entry_header_t));
|
||||||
|
|||||||
Reference in New Issue
Block a user