bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix off-by-one error.


From: Collin Funk
Subject: [PATCH] Fix off-by-one error.
Date: Sat, 21 Sep 2024 22:52:39 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Hi,

When using address sanitizer, there is many occurrences of this error:

  $ grep -r 521 tests/
  tests/testsuite.dir/002/testsuite.log:+    #0 0x4694f0 in code_ns_fraction 
/home/collin/.local/src/tar/src/misc.c:521
  tests/testsuite.dir/002/testsuite.log:+SUMMARY: AddressSanitizer: 
stack-buffer-overflow /home/collin/.local/src/tar/src/misc.c:521 in 
code_ns_fraction
  tests/testsuite.dir/026/testsuite.log:+    #0 0x4694f0 in code_ns_fraction 
/home/collin/.local/src/tar/src/misc.c:521
  tests/testsuite.dir/026/testsuite.log:+SUMMARY: AddressSanitizer: 
stack-buffer-overflow /home/collin/.local/src/tar/src/misc.c:521 in 
code_ns_fraction
  [....]

It seems that the definition of 'TIMESPEC_STRSIZE_BOUND' doesn't account
for the NUL byte. I've attached a fix.

Collin

Attachment: 0001-Fix-off-by-one-error.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]