Skip to content

Commit

Permalink
(compare_files): fix -Wstringop-overread warning exposed on s390x
Browse files Browse the repository at this point in the history
… (GCC 11)

```
../../../src/filemanager/cmd.c: In function ‘compare_files’:
../../../src/filemanager/cmd.c:197:37: warning: ‘memcmp’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overread]
  197 |             result = (n1 != n2) || (memcmp (buf1, buf2, n1) != 0);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Yury V. Zaytsev <[email protected]>
  • Loading branch information
zyv committed Feb 3, 2025
1 parent 5754c5f commit 7d8e82d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/filemanager/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ compare_files (const vfs_path_t *vpath1, const vfs_path_t *vpath2, off_t size)
;
}
while (n1 == n2 && n1 == sizeof (buf1) && memcmp (buf1, buf2, sizeof (buf1)) == 0);
result = (n1 != n2) || (memcmp (buf1, buf2, n1) != 0);
result = (n1 != n2) || (memcmp (buf1, buf2, MIN (n1, sizeof (buf1))) != 0);
rotate_dash (FALSE);

close (file2);
Expand Down

0 comments on commit 7d8e82d

Please sign in to comment.