Ken Thomases : libwine: Fix a potential write through a null pointer. ( Clang).
Alexandre Julliard
julliard at winehq.org
Fri Jan 10 14:44:52 CST 2014
Module: wine
Branch: stable
Commit: acc524066b5a6cce6bbef354f0594f105a8803ed
URL: http://source.winehq.org/git/wine.git/?a=commit;h=acc524066b5a6cce6bbef354f0594f105a8803ed
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).
(cherry picked from commit e577e4b3e646b0a296ce9bbd73f728cc3f92c20e)
---
libs/wine/loader.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index 4e78116..42cd6f5 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -880,10 +880,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