]> mj.ucw.cz Git - pciutils.git/commit
Fixed buffer overflows in ls-tree.c
authorMartin Mares <mj@ucw.cz>
Wed, 22 Jan 2020 08:49:18 +0000 (09:49 +0100)
committerMartin Mares <mj@ucw.cz>
Wed, 22 Jan 2020 08:49:18 +0000 (09:49 +0100)
commit76d47191f9274991059a41e19e1999a12c0d3416
treed7dddfc3dc87393d5a17a94d9b00e67c7040f3b6
parentcb94f26e6933815fe4484cd2697ae7e1ffdcd9ac
Fixed buffer overflows in ls-tree.c

As reported in GitHub issue #24, tree dumping mode can smash the stack
if the hierarchy of buses is too deep.

Increased line buffer size to 1024 and switched to use of snprintf
everywhere, so that in the worst case, the line is truncated.

As snprintf can be problematic on obscure platforms, I wrapped it
in tree_printf(), so that we can add #ifdefs should problems arise.
lib/sysdep.h
ls-tree.c