lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8918310c-d0aa-4e02-b9d4-9aac98b0a48f@gmail.com>
Date: Tue, 14 Oct 2025 10:01:28 -0400
From: Vivek BalachandharTN <vivek.balachandhar@...il.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: gregkh@...uxfoundation.org, johan@...nel.org, elder@...nel.org,
 schopin@...ntu.com, me@...y.me, greybus-dev@...ts.linaro.org,
 linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: greybus: documentation: replace strncpy() with
 strscpy_pad()

Yes, Dan. Nice catch. Building it with below sample change:

memset(&intf_load.firmware_tag, 0, GB_FIRMWARE_U_TAG_MAX_SIZE);
strncpy((char *)&intf_load.firmware_tag, firmware_tag,
         GB_FIRMWARE_U_TAG_MAX_SIZE - 1);

If it works, will send another patch.

Best, Vivek.


On 2025-10-14 9:53 a.m., Dan Carpenter wrote:
> On Tue, Oct 14, 2025 at 01:41:48PM +0000, Vivek BalachandharTN wrote:
>> strncpy() does not guarantee NUL-termination and is deprecated for
>> NUL-terminated strings. Replace it with strscpy_pad(), which guarantees
>> NUL-termination and zero-pads the remaining bytes, matching the fixed-size
>> firmware tag semantics.
>>
>> Signed-off-by: Vivek BalachandharTN <vivek.balachandhar@...il.com>
>> ---
>>   .../greybus/Documentation/firmware/firmware.c        | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/greybus/Documentation/firmware/firmware.c b/drivers/staging/greybus/Documentation/firmware/firmware.c
>> index 3b35ef6d4adb..deac8584841b 100644
>> --- a/drivers/staging/greybus/Documentation/firmware/firmware.c
>> +++ b/drivers/staging/greybus/Documentation/firmware/firmware.c
> This is sample user space code so the strscpy_pad() isn't available.  It
> will break the compile.
>
> regards,
> dan carpenter
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ