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]
Date: Thu, 2 May 2024 07:06:21 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Justin Stitt <justinstitt@...gle.com>
Cc: Petr Mladek <pmladek@...e.com>, Steven Rostedt <rostedt@...dmis.org>,
 John Ogness <john.ogness@...utronix.de>,
 Sergey Senozhatsky <senozhatsky@...omium.org>, linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH] printk: cleanup deprecated uses of strncpy/strcpy

Le 02/05/2024 à 01:18, Justin Stitt a écrit :
> On Wed, May 1, 2024 at 2:39 PM Christophe JAILLET
> <christophe.jaillet@...adoo.fr> wrote:
>> Hi,
>>
>> Nit: The { } around each branch can now also be removed.
> 
> There was one line before and there's one line now.

In the block after the "else", yes, but now the block after the "if" is 
only 1 line. (it was 2 before).

So, {} should now be omitted on both branches.

-    if (str[0] >= '0' && str[0] <= '9') {
-        strcpy(buf, "ttyS");
-        strncpy(buf + 4, str, sizeof(buf) - 5);
+    if (isdigit(str[0])) {
+        scnprintf(buf, sizeof(buf), "ttyS%s", str);
       } else {
-        strncpy(buf, str, sizeof(buf) - 1);
+        strscpy(buf, str);
       }

This is a really minor nitpick. Not sure you need to repost if there is 
no other comment.

CJ

> 
> I'll remove the brackets but I will briefly wait to see if any other
> concerns come in.
> 
> Thanks
> 
>>
>> CJ
>>
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ