From 6724aa4ce1d5362e67c166eb68a013cf3d0b3c41 Mon Sep 17 00:00:00 2001 From: Maks Mishin Date: Thu, 29 Feb 2024 23:29:54 +0300 Subject: [PATCH] gzlib: Add check for res of LSEEK Return value of function LSEEK (lseek64) is not checked, but it is usually checked for this function. Found by RASU JSC. --- gzlib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gzlib.c b/gzlib.c index e485a27..7e2cb18 100644 --- a/gzlib.c +++ b/gzlib.c @@ -244,7 +244,8 @@ local gzFile gz_open(const void *path, int fd, const char *mode) { return NULL; } if (state->mode == GZ_APPEND) { - LSEEK(state->fd, 0, SEEK_END); /* so gzoffset() is correct */ + if (LSEEK(state->fd, 0, SEEK_END) == -1) /* so gzoffset() is correct */ + return NULL; state->mode = GZ_WRITE; /* simplify later checks */ }