[PATCH] setupapi: use strlen instead of sizeof

Marcus Meissner marcus at jet.franken.de
Mon Jul 6 17:52:59 CDT 2015


A bug, but actually makes not problem, as in x86 the string is 4 bytes (same as
sizeof (ptr)), and on amd64 it is 6 (while sizeof(ptr) is 8).
---
 dlls/setupapi/fakedll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c
index d521b0a..d28b8ed 100644
--- a/dlls/setupapi/fakedll.c
+++ b/dlls/setupapi/fakedll.c
@@ -758,7 +758,7 @@ static BOOL CALLBACK register_manifest( HMODULE module, const WCHAR *type, WCHAR
             }
             if (!arch.len)  /* fixup the architecture */
             {
-                char *new_buffer = HeapAlloc( GetProcessHeap(), 0, len + sizeof(current_arch) );
+                char *new_buffer = HeapAlloc( GetProcessHeap(), 0, len + strlen(current_arch) );
                 memcpy( new_buffer, manifest, arch.ptr - manifest );
                 strcpy( new_buffer + (arch.ptr - manifest), current_arch );
                 memcpy( new_buffer + strlen(new_buffer), arch.ptr, len - (arch.ptr - manifest) );
-- 
2.4.3




More information about the wine-patches mailing list