Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Sep 2011 05:17:02 +0200
From:      <olafBuddenhagen@gmx.net>
To:        Robert Millan <rmh@debian.org>
Cc:        freebsd-hackers@freebsd.org, Ed Maste <emaste@freebsd.org>, debian-hurd@lists.debian.org
Subject:   Re: [PATCH] avoid assuming MAXPATHLEN in config(8)
Message-ID:  <20110903031659.GR10284@alien.local>
In-Reply-To: <CAOfDtXNreaFYKvyR_C15dk9mOqU30_Z4gHxQPkPH5ntY7rRtzA@mail.gmail.com>
References:  <CAOfDtXNreaFYKvyR_C15dk9mOqU30_Z4gHxQPkPH5ntY7rRtzA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Thu, Jul 07, 2011 at 11:33:53AM +0200, Robert Millan wrote:

> -	(void)snprintf(fname, sizeof fname, "../../conf/options.%s",
> +	(void)asprintf(&fname, "../../conf/options.%s",
>  	    machinename);

Ignoring the return value of asprintf() is not a good idea, as it can
indicate a failed allocation.

On a related note, the return value of strdup() also should be checked.

-antrik-



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110903031659.GR10284>