]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_logprint: Fix buffer overflow printing quotaoff
authorCarlos Maiolino <cmaiolino@redhat.com>
Thu, 15 Apr 2021 23:04:11 +0000 (19:04 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 15 Apr 2021 23:04:11 +0000 (19:04 -0400)
commit366a2ad5eecc1499e8158509bb9beb86f4e38204
treead5364eda6156605a7edac44e1100137383c7c27
parent6375c5b8e3d8f8f81b4cebd224f856d34706cab6
xfs_logprint: Fix buffer overflow printing quotaoff

xlog_recover_print_quotaoff() was using a static buffer to aggregate
quota option strings to be printed at the end. The buffer size was
miscalculated and when printing all 3 flags, a buffer overflow occurs
crashing xfs_logprint, like:

QOFF: cnt:1 total:1 a:0x560530ff3bb0 len:160
*** buffer overflow detected ***: terminated
Aborted (core dumped)

Fix this by removing the static buffer and using printf() directly to
print each flag. Also add a trailling space before each flag, so they
are a bit more readable on the output.

Reported-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
logprint/log_print_all.c