[PATCH 3/3] [cmd] make test fails with warn+heap

Ann and Jason Edmeades jason at edmeades.me.uk
Tue Sep 4 17:48:26 CDT 2012


When warn+heap is in effect, walking backwards down a string fails
because the check to see if it passes the beginning of the string
is checking the wrong variable. Without warn+heap, the wrong
variable is correctly ordered in memory meaning we do go into the
while loop.

[BUG28258]

Note: No tests as cannot test this explicitly as it all works in
'normal' mode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120904/e9efb627/attachment.html>
-------------- next part --------------
From 134956d7ed01f52fca19de4cc30947d4f64fc9b4 Mon Sep 17 00:00:00 2001
From: Jason Edmeades <jason at edmeades.me.uk>
Date: Tue, 4 Sep 2012 23:40:43 +0100
Subject: [PATCH 3/3] [cmd] make test fails with warn+heap

When warn+heap is in effect, walking backwards down a string fails
because the check to see if it passes the beginning of the string
is checking the wrong variable. Without warn+heap, the wrong
variable is correctly ordered in memory meaning we do go into the
while loop.

[BUG28258]

Note: No tests as cannot test this explicitly as it all works in
'normal' mode
---
 programs/cmd/builtins.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 4ce78f7..b2f9aeb 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -2131,7 +2131,7 @@ void WCMD_setshow_default (const WCHAR *command) {
       if (*command != '"') *pos++ = *command;
       command++;
     }
-    while (pos > command && (*(pos-1) == ' ' || *(pos-1) == '\t'))
+    while (pos > string && (*(pos-1) == ' ' || *(pos-1) == '\t'))
       pos--;
     *pos = 0x00;
 
-- 
1.7.5.4


More information about the wine-patches mailing list