svn commit: r279275 - head/sys/boot/fdt
Pedro Giffuni
pfg at FreeBSD.org
Wed Feb 25 15:44:14 UTC 2015
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 at 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.
More information about the svn-src-all
mailing list