Alexandre Julliard : regedit: Fixed parsing of hex sequences.
Alexandre Julliard
julliard at winehq.org
Mon Jan 7 16:24:56 CST 2008
Module: wine
Branch: master
Commit: 98c133312f20670afed6bbc54cc9aa43ed6c65fa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=98c133312f20670afed6bbc54cc9aa43ed6c65fa
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jan 7 19:56:15 2008 +0100
regedit: Fixed parsing of hex sequences.
---
programs/regedit/regproc.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index fe5323e..705faf6 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -92,15 +92,10 @@ static BYTE* convertHexCSVToHex(char *str, DWORD *size)
*size=0;
while (*s != '\0') {
UINT wc;
- char dummy;
+ char *end;
- if (s[1] != ',' && s[1] != '\0' && s[2] != ',' && s[2] != '\0') {
- fprintf(stderr,"%s: ERROR converting CSV hex stream. Invalid sequence at '%s'\n",
- getAppName(), s);
- HeapFree(GetProcessHeap(), 0, data);
- return NULL;
- }
- if (sscanf(s, "%x%c", &wc, &dummy) < 1 || dummy != ',') {
+ wc = strtoul(s,&end,16);
+ if (end == s || wc > 0xff || (*end && *end != ',')) {
fprintf(stderr,"%s: ERROR converting CSV hex stream. Invalid value at '%s'\n",
getAppName(), s);
HeapFree(GetProcessHeap(), 0, data);
@@ -108,10 +103,8 @@ static BYTE* convertHexCSVToHex(char *str, DWORD *size)
}
*d++ =(BYTE)wc;
(*size)++;
-
- /* Skip one or two digits and any comma */
- while (*s && *s!=',') s++;
- if (*s) s++;
+ if (*end) end++;
+ s = end;
}
return data;
More information about the wine-cvs
mailing list