Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Mar 2017 04:21:03 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316211 - head/sys/kern
Message-ID:  <201703300421.v2U4L39e056271@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703300421.v2U4L39e056271>