bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Replace vsprintf with vsnprintf in ext2fs/msg.c


From: Samuel Thibault
Subject: Re: [PATCH] Replace vsprintf with vsnprintf in ext2fs/msg.c
Date: Sun, 6 Nov 2022 11:45:19 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Hello,

Flavio Cruz, le dim. 06 nov. 2022 01:23:00 -0400, a ecrit:
> ---
>  ext2fs/msg.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/ext2fs/msg.c b/ext2fs/msg.c
> index 83939b06..af636b7c 100644
> --- a/ext2fs/msg.c
> +++ b/ext2fs/msg.c
> @@ -38,7 +38,8 @@ int printf (const char *fmt, ...)
>    return done;
>  }
>  
> -static char error_buf[1024];
> +#define ERROR_BUF_SIZE 1024
> +static char error_buf[ERROR_BUF_SIZE];
>  
>  void _ext2_error (const char * function, const char * fmt, ...)
>  {
> @@ -47,7 +48,7 @@ void _ext2_error (const char * function, const char * fmt, 
> ...)
>    pthread_mutex_lock (&printf_lock);
>  
>    va_start (args, fmt);
> -  vsprintf (error_buf, fmt, args);
> +  vsnprintf (error_buf, ERROR_BUF_SIZE, fmt, args);

Please rather use sizeof (error_buf).

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]