diff options
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r-- | Modules/zlibmodule.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index ba0e59ce064..a1e605b3d2b 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -52,7 +52,13 @@ typedef struct static void zlib_error(z_stream zst, int err, char *msg) { - const char *zmsg = zst.msg; + const char *zmsg = Z_NULL; + /* In case of a version mismatch, zst.msg won't be initialized. + Check for this case first, before looking at zst.msg. */ + if (err == Z_VERSION_ERROR) + zmsg = "library version mismatch"; + if (zmsg == Z_NULL) + zmsg = zst.msg; if (zmsg == Z_NULL) { switch (err) { case Z_BUF_ERROR: |