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.
This commit is contained in:
Maks Mishin 2024-02-29 23:29:54 +03:00
parent 5c42a230b7
commit 6724aa4ce1
1 changed files with 2 additions and 1 deletions

View File

@ -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 */
}