mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: Rich Felker <dalias@libc.org>
Cc: Ismael Luceno <ismael@iodev.co.uk>, musl@lists.openwall.com
Subject: Re: [musl] [PATCH] remove strdupa
Date: Sun, 23 Oct 2022 16:10:46 +0200	[thread overview]
Message-ID: <20221023141046.GM2158779@port70.net> (raw)
In-Reply-To: <20221023054622.GP29905@brightrain.aerifal.cx>

* Rich Felker <dalias@libc.org> [2022-10-23 01:46:22 -0400]:
> On Sat, Oct 22, 2022 at 03:57:23PM +0200, Ismael Luceno wrote:
> > There's no portable way to implement strdupa without double evaluation
> > of it's parameter, and it's use leads to vulnerabilities, since there's
> > no chance to check for stack overruns.
> > 
> > Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
> > ---
> >  include/string.h | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/include/string.h b/include/string.h
> > index 43ad0942edd5..65fe0d503004 100644
> > --- a/include/string.h
> > +++ b/include/string.h
> > @@ -88,7 +88,6 @@ void explicit_bzero (void *, size_t);
> >  #endif
> >  
> >  #ifdef _GNU_SOURCE
> > -#define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
> >  int strverscmp (const char *, const char *);
> >  char *strchrnul(const char *, int);
> >  char *strcasestr(const char *, const char *);
> > -- 
> > 2.38.1
> 
> Does anyone have strong opinions one way or the other on this --
> especially distro folks who'd need to deal with the fallout?

debian code search finds strdupa in 126 packages,
so it is widely used and not trivial to manually fix up,
i'd expect distros to just readd that definition to avoid breakage.

  reply	other threads:[~2022-10-23 14:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 13:57 Ismael Luceno
2022-10-23  5:46 ` Rich Felker
2022-10-23 14:10   ` Szabolcs Nagy [this message]
2022-10-23 15:13     ` Rich Felker
2022-10-23 17:03       ` Rich Felker
2022-10-24  7:58         ` Konstantin P.
2022-10-24  7:59           ` Joakim Sindholt
2022-10-24 14:22           ` Rich Felker

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=20221023141046.GM2158779@port70.net \
    --to=nsz@port70.net \
    --cc=dalias@libc.org \
    --cc=ismael@iodev.co.uk \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).