Author: tsoome
Date: Mon May  6 08:32:49 2019
New Revision: 347179
URL: https://svnweb.freebsd.org/changeset/base/347179

Log:
  MFC r347142:
  
  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

Modified:
  stable/12/stand/common/disk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/disk.c
==============================================================================
--- stable/12/stand/common/disk.c       Mon May  6 08:30:53 2019        
(r347178)
+++ stable/12/stand/common/disk.c       Mon May  6 08:32:49 2019        
(r347179)
@@ -228,6 +228,10 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
        struct ptable_entry part;
        int rc, slice, partition;
 
+       if (sectorsize == 0) {
+               DEBUG("unknown sector size");
+               return (ENXIO);
+       }
        rc = 0;
        od = (struct open_disk *)malloc(sizeof(struct open_disk));
        if (od == NULL) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to