Author: mav
Date: Wed Mar 11 09:49:06 2015
New Revision: 279877
URL: https://svnweb.freebsd.org/changeset/base/279877

Log:
  MFC r279275: Fix potential NULL dereference.
  
  Submitted by: Dmitry Luhtionov <dmitryluhtio...@gmail.com>

Modified:
  stable/10/sys/boot/fdt/fdt_loader_cmd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/fdt/fdt_loader_cmd.c
==============================================================================
--- stable/10/sys/boot/fdt/fdt_loader_cmd.c     Wed Mar 11 09:09:47 2015        
(r279876)
+++ stable/10/sys/boot/fdt/fdt_loader_cmd.c     Wed Mar 11 09:49:06 2015        
(r279877)
@@ -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++) {
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to