Jörg Höhle : winecfg: Prevent crash when clearing volume serial number input.
Alexandre Julliard
julliard at winehq.org
Thu Dec 18 08:09:02 CST 2008
Module: wine
Branch: master
Commit: cda8e4410ace2616fdabde7cebaad3bdeacbbf1f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cda8e4410ace2616fdabde7cebaad3bdeacbbf1f
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Tue Dec 16 10:29:35 2008 +0100
winecfg: Prevent crash when clearing volume serial number input.
---
programs/winecfg/drive.c | 2 +-
programs/winecfg/driveui.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c
index 1a3671c..9e6077c 100644
--- a/programs/winecfg/drive.c
+++ b/programs/winecfg/drive.c
@@ -187,7 +187,7 @@ static void set_drive_serial( char letter, DWORD serial )
HANDLE hFile;
filename[0] = letter;
- WINE_TRACE("Putting serial number of %08x into file '%s'\n", serial, filename);
+ WINE_TRACE("Putting serial number of %08X into file '%s'\n", serial, filename);
hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c
index 375eccb..b9bcd2d 100644
--- a/programs/winecfg/driveui.c
+++ b/programs/winecfg/driveui.c
@@ -520,10 +520,11 @@ static void on_edit_changed(HWND dialog, WORD id)
char *serial;
serial = get_text(dialog, id);
- current_drive->serial = strtoul( serial, NULL, 16 );
+ current_drive->serial = serial ? strtoul( serial, NULL, 16 ) : 0;
+ HeapFree(GetProcessHeap(), 0, serial);
current_drive->modified = TRUE;
- WINE_TRACE("set serial to %08x\n", current_drive->serial);
+ WINE_TRACE("set serial to %08X\n", current_drive->serial);
/* enable the apply button */
SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
@@ -775,7 +776,8 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
current_drive->label = str;
str = get_textW(dialog, IDC_EDIT_SERIAL);
- current_drive->serial = strtoulW( str, NULL, 16 );
+ current_drive->serial = str ? strtoulW( str, NULL, 16 ) : 0;
+ HeapFree(GetProcessHeap(), 0, str);
current_drive->modified = TRUE;
/* TODO: we don't have a device at this point */
More information about the wine-cvs
mailing list