diff options
author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2017-03-24 14:27:59 +0100 |
---|---|---|
committer | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2017-03-24 21:55:57 +0100 |
commit | eeb195e16d075812db0f6030a66bb373bbb6e5e4 (patch) | |
tree | 9e7bbbdab9e1a88654c617dffb983d59da2a0ac3 /gzread.c | |
parent | 61f8c2c4f1d287817d2bddfff002b21ee8a03120 (diff) |
Prevent potential division-by-zero in gzfwrite and gzfread.
Diffstat (limited to 'gzread.c')
-rw-r--r-- | gzread.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -378,6 +378,10 @@ size_t ZEXPORT gzfread(void *buf, size_t size, size_t nitems, gzFile file) { size_t len; gz_state *state; + /* Exit early if size is zero, also prevents potential division by zero */ + if (size == 0) + return 0; + /* get internal structure */ if (file == NULL) return 0; |