[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <197c0910-f1e5-4e55-81a3-59cb2069a1d7@sdfg.com.ar>
Date: Wed, 14 Feb 2024 19:03:10 -0300
From: Rodrigo Campos <rodrigo@...g.com.ar>
To: Willy Tarreau <w@....eu>
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] tools/nolibc: Fix strlcat() return code and size
usage
On 2/14/24 16:34, Rodrigo Campos wrote:
> size_t strlcat_rata(char *dst, const char *src, size_t size)
> {
> const char *orig_src = src;
> size_t len = 0;
> for (;len < size; len++) {
> if (dst[len] == '\0')
> break;
> }
If you think about it, this is strnlen() and what follows is strncat().
> size_t strlcat_willy_fixed(char *dst, const char *src, size_t size)
> {
> const char *orig_src = src;
> size_t len = strlen(dst);
> if (size < len)
> len = size;
Same here.
We can simplify the code by using them, but the size doesn't seem to be
smaller. Let me see what I can do.
Powered by blists - more mailing lists