libtiff: _TIFFCheckDirNumberAndOffset: fix a previous commit

From 749edaed71dff51ce9987c6c879c51d6d709a466 Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Tue, 13 Dec 2022 16:32:52 +0100
Subject: [PATCH] _TIFFCheckDirNumberAndOffset: fix a previous commit

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

diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index b9606f58..1be962ce 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -5398,8 +5398,8 @@ int _TIFFCheckDirNumberAndOffset(TIFF *tif, tdir_t dirn, uint64_t diroff)
         if (foundEntry->offset != diroff)
         {
             TIFFOffsetAndDirNumber entryOld;
-            entryOld.offset = diroff;
-            entryOld.dirNumber = foundEntry->offset;
+            entryOld.offset = foundEntry->offset;
+            entryOld.dirNumber = dirn;
             TIFFOffsetAndDirNumber *foundEntryOld =
                 (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
                     tif->tif_map_dir_offset_to_number, &entryOld);