Author: tsoome
Date: Sun May  5 06:38:47 2019
New Revision: 347142
URL: https://svnweb.freebsd.org/changeset/base/347142

Log:
  loader: validate sectorsize argument in disk_open()
  
  The bug and patch is reported against 11.2, but it is good idea to have
  the check in place for all versions.
  
  PR:           236585
  Submitted by: j...@feith.com
  Reported by:  j...@feith.com
  MFC after:    1 day

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==============================================================================
--- head/stand/common/disk.c    Sun May  5 06:32:40 2019        (r347141)
+++ head/stand/common/disk.c    Sun May  5 06:38:47 2019        (r347142)
@@ -221,6 +221,10 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
        struct ptable_entry part;
        int rc, slice, partition;
 
+       if (sectorsize == 0) {
+               DPRINTF("unknown sector size");
+               return (ENXIO);
+       }
        rc = 0;
        od = (struct open_disk *)malloc(sizeof(struct open_disk));
        if (od == NULL) {
_______________________________________________
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