From fca2d6ac8d62a5edfc6932169164a327899ab3d0 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 21 May 2019 13:24:29 +0200 Subject: [PATCH] zzip: fseeko: fix comparison between incompatible pointer types The C standard does not allow for comparing incompatible pointer types with each other. This causes the C compiler to emit a warning when we try to compare a pointer of type `struct zzip_disk64_trailer` (cast to `void *`) with a pointer of type `unsigned char`. Fix this by comparing `p + sizeof(trailer)` with `buffer + mapsize` instead of using the cast struct. --- zzip/fseeko.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zzip/fseeko.c b/zzip/fseeko.c index 50d4a95..f895690 100644 --- a/zzip/fseeko.c +++ b/zzip/fseeko.c @@ -387,7 +387,7 @@ zzip_entry_findfirst(FILE * disk) errno = EFBIG; goto error2; } - if ((void*)(trailer + 1) > (buffer + mapsize)) + if ((p + sizeof(*trailer)) > (buffer + mapsize)) { debug1("disk64 trailer is not complete"); errno = EBADMSG; -- 2.40.0