From 89792147b0a1d1e9e8048d2d7aa1605b5ba8028f Mon Sep 17 00:00:00 2001 From: Frode Solheim Date: Thu, 30 Jan 2014 00:59:04 +0100 Subject: [PATCH] Fixed an invalid write in disk.cpp:tobin When the loop is done, i == -1 and so buf[-1] is set 0 (I guess the loop at one point counted upwards instead). Static memory is initialized to zero anyway so left out buf[8] = 0;. --- disk.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/disk.cpp b/disk.cpp index b4165375..33972653 100644 --- a/disk.cpp +++ b/disk.cpp @@ -2651,11 +2651,9 @@ int disk_empty (int num) static TCHAR *tobin (uae_u8 v) { - int i; - static TCHAR buf[10]; - for( i = 7; i >= 0; i--) + static TCHAR buf[9]; + for (int i = 7; i >= 0; i--) buf[7 - i] = v & (1 << i) ? '1' : '0'; - buf[i] = 0; return buf; } -- 2.47.3