Skip to content

Commit

Permalink
Add bounds checking to ERR_MSG() macro, used by zError().
Browse files Browse the repository at this point in the history
  • Loading branch information
madler committed Jan 14, 2024
1 parent 643e17b commit 431a9b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef unsigned long ulg;
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */

#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]

#define ERR_RETURN(strm,err) \
return (strm->msg = ERR_MSG(err), (err))
Expand Down

0 comments on commit 431a9b6

Please sign in to comment.