From: Alejandro Colomar <alx.manpages@gmail.com>
To: linux-man@vger.kernel.org
Cc: Alejandro Colomar <alx@kernel.org>, libc-alpha@sourceware.org
Subject: [PATCH] strcat.3: SYNOPSIS: Fix the size of 'dest'
Date: Mon, 5 Dec 2022 16:11:03 +0100 [thread overview]
Message-ID: <20221205151102.13042-1-alx@kernel.org> (raw)
I had a mistake when adding VLA syntax to this prototype. From this
fixed prototype, it's visible how broken the design for this function
is. Next move is to kill this function.
Cc: <libc-alpha@sourceware.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
Hi!
I'm continuing my indiscriminated shooting against broken functions.
I don't remember if I ever used it, but it got me surprised for how much
broken it is.
Please kill this function in glibc. The updated prototype using a bit
of imagination to overextend VLA syntax to show how it behaves, shows
how broken it is.
It is impossible to use this function correctly (okay, it you try hard,
you can, but only for the pleasure of using it without crashing, not for
anything useful).
Cheers,
Alex
man3/strcat.3 | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/man3/strcat.3 b/man3/strcat.3
index a4a376ba9..61d3e54f1 100644
--- a/man3/strcat.3
+++ b/man3/strcat.3
@@ -20,9 +20,8 @@ .SH SYNOPSIS
.B #include <string.h>
.PP
.BI "char *strcat(char *restrict " dest ", const char *restrict " src );
-.BI "char *strncat(char " dest "[restrict ." n "], \
-const char " src "[restrict ." n ],
-.BI " size_t " n );
+.BI "char *strncat(char " dest "[restrict strlen(." dest ") + strnlen(." n ") + 1],"
+.BI " const char " src "[restrict ." n "], size_t " n );
.fi
.SH DESCRIPTION
The
--
2.38.1
next reply other threads:[~2022-12-05 15:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 15:11 Alejandro Colomar [this message]
2022-12-05 17:48 ` [PATCH] strcat.3: SYNOPSIS: Fix the size of 'dest' Russ Allbery
2022-12-05 21:10 ` Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221205151102.13042-1-alx@kernel.org \
--to=alx.manpages@gmail.com \
--cc=alx@kernel.org \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox