diff options
author | Pali Rohár <pali@kernel.org> | 2022-02-28 00:06:00 +0100 |
---|---|---|
committer | Pali Rohár <pali@kernel.org> | 2022-04-16 00:01:13 +0200 |
commit | 7eb8b9473317562e0b66bd3e8c467e127d88dac8 (patch) | |
tree | 8bf6751403297c30db60e2bdde37ea01fdc79a74 | |
parent | d0b3d60f84fff7ab9ce99691fcf0db65b416e9ae (diff) | |
download | pciutils-7eb8b9473317562e0b66bd3e8c467e127d88dac8.tar.gz |
lspci: Fix handling of truncated lines for msvcrt.dll
msvcrt.dll's vsnprintf() implementation does not fill terminating null byte
when overflow occurs and buffer size is returned.
-rw-r--r-- | ls-tree.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -239,7 +239,11 @@ tree_printf(char *line, char *p, char *fmt, ...) p += space; } else if (res >= space) - p += space; + { + /* Ancient C libraries do not truncate the output properly. */ + *(p+space-1) = 0; + p += space; + } else p += res; |