Ken Thomases : libwine: Fix a potential write through a null pointer. ( Clang).

Alexandre Julliard julliard at winehq.org
Mon Oct 21 14:58:24 CDT 2013


Module: wine
Branch: master
Commit: e577e4b3e646b0a296ce9bbd73f728cc3f92c20e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e577e4b3e646b0a296ce9bbd73f728cc3f92c20e

Author: Ken Thomases <ken at codeweavers.com>
Date:   Sun Oct 20 23:55:47 2013 -0500

libwine: Fix a potential write through a null pointer. (Clang).

---

 libs/wine/loader.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index f59942d..5c0192d 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -985,10 +985,13 @@ void *wine_dlopen( const char *filename, int flag, char *error, size_t errorsize
     {
         if (pread( fd, magic, 2, 0 ) == 2 && magic[0] == 'M' && magic[1] == 'Z')
         {
-            static const char msg[] = "MZ format";
-            size_t len = min( errorsize, sizeof(msg) );
-            memcpy( error, msg, len );
-            error[len - 1] = 0;
+            if (error && errorsize)
+            {
+                static const char msg[] = "MZ format";
+                size_t len = min( errorsize, sizeof(msg) );
+                memcpy( error, msg, len );
+                error[len - 1] = 0;
+            }
             close( fd );
             return NULL;
         }




More information about the wine-cvs mailing list