svn commit: r316211 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Mar 30 04:21:04 UTC 2017


Author: kib
Date: Thu Mar 30 04:21:02 2017
New Revision: 316211
URL: https://svnweb.freebsd.org/changeset/base/316211

Log:
  A followup to r315749, two more places where brand->interp_path was
  accessed unconditionally.
  
  Reported by:	se
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Thu Mar 30 02:50:21 2017	(r316210)
+++ head/sys/kern/imgact_elf.c	Thu Mar 30 04:21:02 2017	(r316211)
@@ -291,9 +291,11 @@ __elfN(get_brandinfo)(struct image_param
 			 * this, we return first brand which accepted
 			 * our note and, optionally, header.
 			 */
-			if (ret && bi_m == NULL && (strlen(bi->interp_path) +
-			    1 != interp_name_len || strncmp(interp,
-			    bi->interp_path, interp_name_len) != 0)) {
+			if (ret && bi_m == NULL && interp != NULL &&
+			    (bi->interp_path == NULL ||
+			    (strlen(bi->interp_path) + 1 != interp_name_len ||
+			    strncmp(interp, bi->interp_path, interp_name_len)
+			    != 0))) {
 				bi_m = bi;
 				ret = 0;
 			}
@@ -360,6 +362,7 @@ __elfN(get_brandinfo)(struct image_param
 			    != 0)
 				continue;
 			if (hdr->e_machine == bi->machine &&
+			    bi->interp_path != NULL &&
 			    /* ELF image p_filesz includes terminating zero */
 			    strlen(bi->interp_path) + 1 == interp_name_len &&
 			    strncmp(interp, bi->interp_path, interp_name_len)


More information about the svn-src-all mailing list