mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
ndisasm: Stack buffer overflow fix
Changing the type of `to_read` from `uint32_t` to `int32_t` makes it aware of negative numbers and fixes the buffer overflow in ndisasm. Signed-off-by: T Turek <tureqsec@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
@@ -297,7 +297,7 @@ int main(int argc, char **argv)
|
|||||||
p = q = buffer;
|
p = q = buffer;
|
||||||
nextsync = next_sync(offset, &synclen);
|
nextsync = next_sync(offset, &synclen);
|
||||||
do {
|
do {
|
||||||
uint32_t to_read = buffer + sizeof(buffer) - p;
|
int32_t to_read = buffer + sizeof(buffer) - p;
|
||||||
if ((nextsync || synclen) &&
|
if ((nextsync || synclen) &&
|
||||||
to_read > nextsync - offset - (p - q))
|
to_read > nextsync - offset - (p - q))
|
||||||
to_read = nextsync - offset - (p - q);
|
to_read = nextsync - offset - (p - q);
|
||||||
|
Reference in New Issue
Block a user