Oops, there was one more mistake in the big patch last week.

2025-12-15  Bruno Haible  <[email protected]>

        utimecmp: Fix undefined behaviour (regression 2025-12-09).
        Reported by Coverity.
        * lib/utimecmp.c (utimecmpat): Make sure 'tmp_dst_res' has a sufficient
        lifetime.

diff --git a/lib/utimecmp.c b/lib/utimecmp.c
index 30ad335b08..fba73521d1 100644
--- a/lib/utimecmp.c
+++ b/lib/utimecmp.c
@@ -189,6 +189,7 @@ utimecmpat (int dfd, char const *dst_name,
 
       /* Try to do a hash lookup, but fall back to stack variables and
          recomputation on low memory situations.  */
+      struct fs_res tmp_dst_res;
       if (! ht)
         ht = hash_initialize (16, NULL, dev_info_hash, dev_info_compare, free);
       if (ht)
@@ -216,7 +217,6 @@ utimecmpat (int dfd, char const *dst_name,
       else
         {
         low_memory: ;
-          struct fs_res tmp_dst_res;
           if (ht)
             {
               tmp_dst_res.dev = dst_stat->st_dev;




Reply via email to