libtiff: tiffdump: Avoid overflow warning when reading

From 7643b4c434bc0681e6cf65b886c6c9fa9ce7988e Mon Sep 17 00:00:00 2001
From: Roger Leigh <[EMAIL REDACTED]>
Date: Sat, 4 Jun 2022 19:56:51 +0100
Subject: [PATCH] tiffdump: Avoid overflow warning when reading

---
 tools/tiffdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/tiffdump.c b/tools/tiffdump.c
index 3d91c6ad..e4e239d1 100644
--- a/tools/tiffdump.c
+++ b/tools/tiffdump.c
@@ -192,7 +192,7 @@ dump(int fd, uint64_t diroff)
 		TIFFSwabShort(&hdr.common.tiff_version);
 	if (hdr.common.tiff_version==42)
 	{
-		if (read(fd, (char*) &hdr.classic.tiff_diroff, 4) != 4)
+		if (read(fd, ((char*) &hdr.classic) + offsetof(TIFFHeaderClassic, tiff_diroff), 4) != 4)
 			ReadError("TIFF header");
 		if (swabflag)
 			TIFFSwabLong(&hdr.classic.tiff_diroff);
@@ -205,7 +205,7 @@ dump(int fd, uint64_t diroff)
 	}
 	else if (hdr.common.tiff_version==43)
 	{
-		if (read(fd, (char*) &hdr.big.tiff_offsetsize, 12) != 12)
+		if (read(fd, ((char*) &hdr.big) + offsetof(TIFFHeaderBig, tiff_offsetsize), 12) != 12)
 			ReadError("TIFF header");
 		if (swabflag)
 		{