Skip to content

Commit a9faae3

Browse files
turektcyrillos
authored andcommitted
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>
1 parent aa2dcde commit a9faae3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

disasm/ndisasm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ int main(int argc, char **argv)
297297
p = q = buffer;
298298
nextsync = next_sync(offset, &synclen);
299299
do {
300-
uint32_t to_read = buffer + sizeof(buffer) - p;
300+
int32_t to_read = buffer + sizeof(buffer) - p;
301301
if ((nextsync || synclen) &&
302302
to_read > nextsync - offset - (p - q))
303303
to_read = nextsync - offset - (p - q);

0 commit comments

Comments
 (0)