-
tests: iterator::workdir: fix GCC warning · 1bf57b5a
Since GCC 8.1, the compiler performs some bounds checking when copying static data into arrays with a known size. In one test, we print a format string of "%s/sub%02d" into a buffer of 64 bytes. The input buffer for the first "%s" is bounded to at most 63 characters, plus four bytes for the static string "/sub" plus two more bytes for "%02d". Thus, our target buffer needs to be at least 70 bytes in size, including the NUL byte. There seems to be a bug in the analysis, though, because GCC will not account for the limiting "%02" prefix, treating it as requiring the same count of bytes as a "%d". Thus, we end up at 79 bytes that are required to fix the warning. To make it look nicer and less special, we just round the buffer size up to 80 bytes.
Patrick Steinhardt committed
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
index.c | Loading commit data... | |
iterator_helpers.c | Loading commit data... | |
iterator_helpers.h | Loading commit data... | |
tree.c | Loading commit data... | |
workdir.c | Loading commit data... |