Hi Greg,
On 14. Aug 2025, at 16:35, Greg Kroah-Hartman wrote:
> On Thu, Aug 14, 2025 at 02:35:56PM +0200, Greg Kroah-Hartman wrote:
>> On Thu, Aug 14, 2025 at 02:03:37PM +0200, Thorsten Blum wrote:
>>> [...]
>>> - strcpy(kdb_grep_string, cp);
>>> + strscpy(kdb_grep_string, cp);
>>
>> If this was just a search/replace, it would have been done already, so
>> why is this ok?
>
> I missed that strscpy() can now handle 2 arguments like this, so yes,
> this should be ok.
>
> BUT, you just checked the length above this line, which now isn't
> needed, right? So this function can get simpler?
Yes, this could just be
memcpy(kdb_grep_string, cp, len + 1);
because we already know the length which strscpy() would just recompute
before calling memcpy() internally. I'll submit a v2.
>>> - strscpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
>>> + strscpy(cmd_cur, cmd_hist[cmdptr]);
>>
>> Same here. And other places...
>
> Sorry, this should also be ok, BUT it's really just doing the same exact
> thing, right?
Yes, it's the same because sizeof(cmd_cur) equals CMD_BUFLEN.
Thanks,
Thorsten