]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: fix a complaint about a printf buffer overrun
authorDarrick J. Wong <djwong@kernel.org>
Wed, 18 May 2022 02:48:07 +0000 (22:48 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 18 May 2022 02:48:07 +0000 (22:48 -0400)
gcc 11 warns that stack_f doesn't allocate a sufficiently large buffer
to hold the printf output.  I don't think the io cursor stack is really
going to grow to 4 billion levels deep, but let's fix this anyway.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/io.c

diff --git a/db/io.c b/db/io.c
index 98f4e60502fec76bff1a73000f9d6c59aa049f8f..bfc86cc4a1215e4b4b16f61331847ba30749eb01 100644 (file)
--- a/db/io.c
+++ b/db/io.c
@@ -638,7 +638,7 @@ stack_f(
        char    **argv)
 {
        int     i;
-       char    tagbuf[8];
+       char    tagbuf[14];
 
        for (i = iocur_sp; i > 0; i--) {
                snprintf(tagbuf, sizeof(tagbuf), "%d: ", i);