[PATCH 01/10] wined3d: Get rid of a redundant strcpy().

Henri Verbeet hverbeet at codeweavers.com
Thu Sep 17 05:35:21 CDT 2009


---
 dlls/wined3d/wined3d_main.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 67b1acd..5f19c26 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -5,6 +5,7 @@
  * Copyright 2002-2003 Raphael Junqueira
  * Copyright 2004      Jason Edmeades
  * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
+ * Copyright 2009 Henri Verbeet for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -293,8 +294,11 @@ static BOOL wined3d_init(HINSTANCE hInstDLL)
         }
         if ( !get_config_key( hkey, appkey, "WineLogo", buffer, size) )
         {
-            wined3d_settings.logo = HeapAlloc(GetProcessHeap(), 0, strlen(buffer) + 1);
-            if(wined3d_settings.logo) strcpy(wined3d_settings.logo, buffer);
+            size_t len = strlen(buffer) + 1;
+
+            wined3d_settings.logo = HeapAlloc(GetProcessHeap(), 0, len);
+            if (!wined3d_settings.logo) ERR("Failed to allocate logo path memory.\n");
+            else memcpy(wined3d_settings.logo, buffer, len);
         }
         if ( !get_config_key( hkey, appkey, "Multisampling", buffer, size) )
         {
-- 
1.6.0.6




More information about the wine-patches mailing list