From: Pali Rohár Date: Sun, 27 Feb 2022 23:06:00 +0000 (+0100) Subject: lspci: Fix handling of truncated lines for msvcrt.dll X-Git-Tag: v3.8.0~10 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=7eb8b9473317562e0b66bd3e8c467e127d88dac8;p=pciutils.git 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. --- diff --git a/ls-tree.c b/ls-tree.c index e845f66..cc65ac4 100644 --- a/ls-tree.c +++ b/ls-tree.c @@ -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;