[LTP] Subject: [PATCH] fs/doio:Use the snprintf function to prevent buffer overflow
zenghao
crawler2015@163.com
Sun Apr 23 05:04:47 CEST 2023
Hi Cyril, Thanks very much for your review!
I have changed my email address to zenghao@kylinos.cn and provided V2.
Thank you again for the correction, I will learn and correct it
Best regards
-- Hao
At 2023-04-21 19:25:45, "Cyril Hrubis" <chrubis@suse.cz> wrote:
>Hi!
>> From 044a942863dc0ac84701bc14d78f4d7fc0bb8dcb Mon Sep 17 00:00:00 2001
>> From: Hao Zeng <zenghao@kylinos.cn>
>> Date: Mon, 10 Apr 2023 09:17:34 +0800
>> Subject: [PATCH] fs/doio:Use the snprintf function to prevent buffer overflow
>> Use the snprintf function instead of sprintf in the write_log.c file
>> Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
>
>The actual change looks good, however the patch is corrupted, looks like
>your email client replaced spaces 0x20 with unicode non-breakable spaces
>0xc2a0.
>
>See: https://www.kernel.org/doc/html/v4.10/process/email-clients.html
>
>> ---
>> testcases/kernel/fs/doio/write_log.c | 20 ++++++++++----------
>> 1 file changed, 10 insertions(+), 10 deletions(-)
>>
>>
>> diff --git a/testcases/kernel/fs/doio/write_log.c b/testcases/kernel/fs/doio/write_log.c
>> index e8ef9c7cb..86297b01d 100644
>> --- a/testcases/kernel/fs/doio/write_log.c
>> +++ b/testcases/kernel/fs/doio/write_log.c
>> @@ -129,7 +129,7 @@ int wlog_open(struct wlog_file *wfile, int trunc, int mode)
>> umask(omask);
>>
>> if (wfile->w_afd == -1) {
>> - sprintf(Wlog_Error_String,
>> + snprintf(Wlog_Error_String,sizeof(Wlog_Error_String),
> ^
> There should be space after
> comma.
>
>--
>Cyril Hrubis
>chrubis@suse.cz
More information about the ltp
mailing list