]> git.saurik.com Git - wxWidgets.git/commitdiff
don't use strcpy to copy between overlapping strings, it's undefined operation
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 11 Apr 2004 21:36:06 +0000 (21:36 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 11 Apr 2004 21:36:06 +0000 (21:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/xpmdecod.cpp

index 358131f241f007791e9f37f1ae8b7be32905fc12..f8524971a0e7e2f2d8b465c658a6b8537e507b79 100644 (file)
@@ -178,7 +178,10 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream)
             if ( (*q == '*') && (*(q + 1) == '/') )
                 break;
         }
-        strcpy(p, q + 2);
+        
+        // memmove allows overlaps (unlike strcpy):
+        size_t cpylen = strlen(q + 2) + 1;
+        memmove(p, q + 2, cpylen); 
     }
 
     /*