mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08: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:
parent
aa2dcdec09
commit
a9faae3e0b
@ -297,7 +297,7 @@ int main(int argc, char **argv)
|
||||
p = q = buffer;
|
||||
nextsync = next_sync(offset, &synclen);
|
||||
do {
|
||||
uint32_t to_read = buffer + sizeof(buffer) - p;
|
||||
int32_t to_read = buffer + sizeof(buffer) - p;
|
||||
if ((nextsync || synclen) &&
|
||||
to_read > nextsync - offset - (p - q))
|
||||
to_read = nextsync - offset - (p - q);
|
||||
|
Loading…
Reference in New Issue
Block a user