[PATCH] shell32: handle corrupt entry in iconcache registry entry (Coverity)
Marcus Meissner
marcus at jet.franken.de
Thu Dec 3 16:47:31 CST 2009
Hi,
Coverity rightfully sees that the registry entry might not have a ,
which causes our code to crash.
return error in that case and print a ERR() message.
Ciao, Marcus
---
dlls/shell32/iconcache.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index b51ff06..c4087d2 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -495,9 +495,13 @@ static int SIC_LoadOverlayIcon(int icon_idx)
{
LPWSTR p = strchrW(buffer, ',');
- if (p)
- *p++ = 0;
-
+ if (!p)
+ {
+ ERR("Icon index in %s/%s corrupted, no comma.\n", debugstr_w(wszShellIcons),debugstr_w(wszIdx));
+ RegCloseKey(hKeyShellIcons);
+ return -1;
+ }
+ *p++ = 0;
iconPath = buffer;
iconIdx = atoiW(p);
}
--
1.5.6
More information about the wine-patches
mailing list