All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] strcat.3: SYNOPSIS: Fix the size of 'dest'
@ 2022-12-05 15:11 Alejandro Colomar
  2022-12-05 17:48 ` Russ Allbery
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2022-12-05 15:11 UTC (permalink / raw)
  To: linux-man; +Cc: Alejandro Colomar, libc-alpha

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-05 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05 15:11 [PATCH] strcat.3: SYNOPSIS: Fix the size of 'dest' Alejandro Colomar
2022-12-05 17:48 ` Russ Allbery
2022-12-05 21:10   ` Alejandro Colomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.