diff mbox series

Avoid format truncation

Message ID 20211114211457.199710-1-bbonev@ipacct.com (mailing list archive)
State Deferred, archived
Headers show
Series Avoid format truncation | expand

Commit Message

Boian Bonev Nov. 14, 2021, 9:14 p.m. UTC
io.c:644:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 8

Signed-off-by: Boian Bonev <bbonev@ipacct.com>
---
 db/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong Nov. 15, 2021, 4:45 p.m. UTC | #1
On Sun, Nov 14, 2021 at 11:14:58PM +0200, Boian Bonev wrote:
> io.c:644:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 8
> 
> Signed-off-by: Boian Bonev <bbonev@ipacct.com>

I really hope nobody ever gets to a cursor depth of 4 billion, but the
logic is correct, so...

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  db/io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/db/io.c b/db/io.c
> index c79cf105..154c3bd9 100644
> --- 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);
> -- 
> 2.33.1
>
diff mbox series

Patch

diff --git a/db/io.c b/db/io.c
index c79cf105..154c3bd9 100644
--- 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);