[PATCH] shell32: replace strcpy by memcpy due to slightly undefined struct handling

Marcus Meissner meissner at suse.de
Mon Feb 15 10:23:05 CST 2010


Hi,

Writing over the end of a struct via char[1] is only well defined if the struct
is standalone and not contained in another struct.

So for gcc 4.5 the strcpy triggers a fortify overflow error and we
better use memcpy.

Ciao, Marcus
---
 dlls/shell32/pidl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index 3e61144..a7704b3 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -1606,7 +1606,7 @@ LPITEMIDLIST _ILCreateEntireNetwork(void)
         LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
 
         pData->u.network.dummy = 0;
-        strcpy(pData->u.network.szNames, "Entire Network");
+        memcpy(pData->u.network.szNames, "Entire Network", sizeof("Entire Network")+1);
     }
     return pidlOut;
 }
-- 
1.6.6.1



More information about the wine-patches mailing list