From 97a4384dc065b43e7c858c3d4d5fc17f962ef351 Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Fri, 25 Oct 2002 19:01:32 +0000 Subject: [PATCH] Fixed behaviour of "x /s ...". --- programs/winedbg/memory.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index 49454f5eb84..6cab892b669 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -285,6 +285,7 @@ void DEBUG_ExamineMemory( const DBG_VALUE *_value, int count, char format ) DEBUG_Printf(DBG_CHN_MESG, "\n"); return; case 's': + if (count == 1) count = 256; DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &value.addr, count); DEBUG_Printf(DBG_CHN_MESG, "\n"); return; @@ -350,16 +351,14 @@ int DEBUG_PrintStringA(int chnl, const DBG_ADDR* address, int len) if (len == -1) len = 32767; /* should be big enough */ - /* so that the ach is always terminated */ - ach[sizeof(ach) - 1] = '\0'; - for (i = len; i >= 0; i -= sizeof(ach) - 1) + for (i = len; i > 0; i -= l) { l = min(sizeof(ach) - 1, i); DEBUG_READ_MEM_VERBOSE(lin, ach, l); + ach[l] = '\0'; /* protect from displaying junk */ l = strlen(ach); DEBUG_OutputA(chnl, ach, l); lin += l; - if (l < sizeof(ach) - 1) break; } return len - i; /* number of actually written chars */ }