From: Frode Solheim Date: Wed, 29 Jan 2014 23:59:04 +0000 (+0100) Subject: Fixed an invalid write in disk.cpp:tobin X-Git-Tag: 2800~34^2 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=89792147b0a1d1e9e8048d2d7aa1605b5ba8028f;p=francis%2Fwinuae.git 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;. --- 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; }