Author: trasz
Date: Sun Feb 19 16:08:58 2017
New Revision: 313943
URL: https://svnweb.freebsd.org/changeset/base/313943

Log:
  Make mdconfig(8) not segfault when the kernel returns garbage data.
  
  MFC after:    2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/sbin/mdconfig/mdconfig.c

Modified: head/sbin/mdconfig/mdconfig.c
==============================================================================
--- head/sbin/mdconfig/mdconfig.c       Sun Feb 19 14:53:59 2017        
(r313942)
+++ head/sbin/mdconfig/mdconfig.c       Sun Feb 19 16:08:58 2017        
(r313943)
@@ -452,8 +452,8 @@ md_list(const char *units, int opt, cons
                        }
                        gc = &pp->lg_config;
                        type = geom_config_get(gc, "type");
-                       if (strcmp(type, "vnode") == 0 ||
-                           strcmp(type, "preload") == 0) {
+                       if (type != NULL && (strcmp(type, "vnode") == 0 ||
+                           strcmp(type, "preload") == 0)) {
                                file = geom_config_get(gc, "file");
                                if (fflag != NULL &&
                                    strcmp(fflag, file) != 0)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to