[PATCH] winecfg: Fix a typo in autodetect_drives

Ben Klein shacklein at gmail.com
Wed Jan 21 04:44:42 CST 2009


The test in autodetect_drives is meant to check to see if the next drive letter
is invalid. Before this patch, it checks to see if letter == ']' (where it
should test for letter == '['). This appears to cause array bounds to be
exceeded on drives[], and seems to trigger null-pointer dereferences in some
circumstances.

This patch corrects the test to check to see if the letter is ('Z' + 1), which
is used as a validity test elsewhere in the file.
-------------- next part --------------
From 1102993b78f094ec0366f6821fcab3b98d599c89 Mon Sep 17 00:00:00 2001
From: Ben Klein <shacklein at gmail.com>
Date: Wed, 21 Jan 2009 21:02:12 +1100
Subject: [PATCH] winecfg: Fix a typo in autodetect_drives

The test in autodetect_drives is meant to check to see if the next drive letter
is invalid. Before this patch, it checks to see if letter == ']' (where it
should test for letter == '['). This appears to cause array bounds to be
exceeded on drives[], and seems to trigger null-pointer dereferences in some
circumstances.

This patch corrects the test to check to see if the letter is ('Z' + 1), which
is used as a validity test elsewhere in the file.
---
 programs/winecfg/drivedetect.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/programs/winecfg/drivedetect.c b/programs/winecfg/drivedetect.c
index 1c03b6f..7e2313c 100644
--- a/programs/winecfg/drivedetect.c
+++ b/programs/winecfg/drivedetect.c
@@ -349,7 +349,7 @@ int autodetect_drives(void)
         
         /* allocate a drive for it */
         letter = allocate_letter(type);
-        if (letter == ']')
+        if (letter == ('Z' + 1))
         {
             report_error(NO_MORE_LETTERS);
             fclose(fstab);
-- 
1.5.6.5


More information about the wine-patches mailing list