[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQKwOo=Oas+7Du9+neSm=Ev6pxdPV7ges7eEEpW+jh8Ug@mail.gmail.com>
Date: Thu, 27 Aug 2020 07:59:45 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Joe Perches <joe@...ches.com>,
clang-built-linux <clang-built-linux@...glegroups.com>,
stable <stable@...r.kernel.org>, Andy Lavr <andy.lavr@...il.com>,
Arvind Sankar <nivedita@...m.mit.edu>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Sami Tolvanen <samitolvanen@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
Yury Norov <yury.norov@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] lib/string.c: implement stpcpy
On Thu, Aug 27, 2020 at 1:58 AM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
>
> On Wed, Aug 26, 2020 at 9:57 AM Joe Perches <joe@...ches.com> wrote:
> >
> > On Thu, 2020-08-27 at 01:49 +0900, Masahiro Yamada wrote:
> > > I do not have time to keep track of the discussion fully,
> > > but could you give me a little more context why
> > > the usage of stpcpy() is not recommended ?
> > >
> > > The implementation of strcpy() is almost the same.
> > > It is unclear to me what makes stpcpy() unsafe..
>
> https://lore.kernel.org/lkml/202008150921.B70721A359@keescook/
>
> >
> > It's the same thing that makes strcpy unsafe:
> >
> > Unchecked buffer lengths with no guarantee src is terminated.
>
OK, then stpcpy(), strcpy() and sprintf()
have the same level of unsafety.
strcpy() is used everywhere.
I am not convinced why only stpcpy() should be hidden.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists