From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: Re: [iproute PATCH] ip netns: Make sure netns name is sane
Date: Wed, 12 Jul 2017 20:12:53 +0200 [thread overview]
Message-ID: <20170712181253.GB16375@orbyte.nwl.cc> (raw)
In-Reply-To: <20170712093834.3902c59d@xeon-e3>
On Wed, Jul 12, 2017 at 09:38:34AM -0700, Stephen Hemminger wrote:
> On Mon, 10 Jul 2017 13:19:12 +0200
> Phil Sutter <phil@nwl.cc> wrote:
>
> > +static bool is_basename(const char *name)
> > +{
> > + char *name_dup = strdup(name);
> > + bool rc = true;
> > +
> > + if (!name_dup)
> > + return false;
> > +
> > + if (strcmp(basename(name_dup), name))
> > + rc = false;
> > +
> > + free(name_dup);
> > + return rc;
> > +}
>
> Looks like natural place to use strdupa.
>
> static bool is_basename(const char *name)
> {
> return strcmp(basename(strdupa(name), name) == 0;
> }
Good point! Anyway, my patch fails to cover 'ip netns del' command
(apart from the '..' issue), so I'd suggest to instead apply Matteo's
version (Message-ID 20170710120831.9355-1-mcroce@redhat.com).
Thanks, Phil
prev parent reply other threads:[~2017-07-12 18:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 11:19 [iproute PATCH] ip netns: Make sure netns name is sane Phil Sutter
2017-07-10 15:17 ` Stephen Hemminger
2017-07-12 12:38 ` Phil Sutter
2017-07-12 16:38 ` Stephen Hemminger
2017-07-12 18:12 ` Phil Sutter [this message]
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=20170712181253.GB16375@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).