lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170712093834.3902c59d@xeon-e3>
Date:   Wed, 12 Jul 2017 09:38:34 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Phil Sutter <phil@....cc>
Cc:     netdev@...r.kernel.org
Subject: Re: [iproute PATCH] ip netns: Make sure netns name is sane

On Mon, 10 Jul 2017 13:19:12 +0200
Phil Sutter <phil@....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;
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ