Fix allocate_filenum last dir/file checks
authorAlan Modra <amodra@gmail.com>
Mon, 20 Sep 2021 02:45:20 +0000 (12:15 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 20 Sep 2021 04:31:11 +0000 (14:01 +0930)
* dwarf2dbg.c (allocate_filenum) Correct use of last_used_dir_len.

gas/dwarf2dbg.c

index e2abe19c88a48e484287b326f6ea3ff26f6924fb..c6e439aa86267363ef51af7ede4b4bd02ccf7410 100644 (file)
@@ -730,9 +730,9 @@ allocate_filenum (const char * pathname)
        }
       else
        {
-         if (filename_ncmp (pathname, dirname, last_used_dir_len) == 0
-             && IS_DIR_SEPARATOR (pathname [last_used_dir_len])
-             && filename_cmp (pathname + last_used_dir_len + 1,
+         if (filename_ncmp (pathname, dirname, last_used_dir_len - 1) == 0
+             && IS_DIR_SEPARATOR (pathname [last_used_dir_len - 1])
+             && filename_cmp (pathname + last_used_dir_len,
                               files[last_used].filename) == 0)
            return last_used;
        }