Date: Wed, 25 Feb 2015 10:44:14 -0500 From: Pedro Giffuni <pfg@FreeBSD.org> To: Alexander Motin <mav@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r279275 - head/sys/boot/fdt Message-ID: <54EDEDCE.80801@FreeBSD.org> In-Reply-To: <201502250957.t1P9v5hU004973@svn.freebsd.org> References: <201502250957.t1P9v5hU004973@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 25/02/2015 04:57 a.m., Alexander Motin wrote: > Author: mav > Date: Wed Feb 25 09:57:05 2015 > New Revision: 279275 > URL: https://svnweb.freebsd.org/changeset/base/279275 > > Log: > Fix potential NULL dereference. > > Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> > MFC after: 2 weeks > > Modified: > head/sys/boot/fdt/fdt_loader_cmd.c > > Modified: head/sys/boot/fdt/fdt_loader_cmd.c > ============================================================================== > --- head/sys/boot/fdt/fdt_loader_cmd.c Wed Feb 25 09:21:59 2015 (r279274) > +++ head/sys/boot/fdt/fdt_loader_cmd.c Wed Feb 25 09:57:05 2015 (r279275) > @@ -1299,13 +1299,12 @@ fdt_merge_strings(int argc, char *argv[] > sz += argc - start; > > buf = (char *)malloc(sizeof(char) * sz); > - bzero(buf, sizeof(char) * sz); > - > if (buf == NULL) { > sprintf(command_errbuf, "could not allocate space " > "for string"); > return (1); > } > + bzero(buf, sizeof(char) * sz); > > idx = 0; > for (i = start, idx = 0; i < argc; i++) { > Looks like a job for calloc(3) Cheers, Pedro.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54EDEDCE.80801>