svn commit: r353977 - stable/12/stand/common

Kyle Evans kevans at FreeBSD.org
Thu Oct 24 02:34:49 UTC 2019


Author: kevans
Date: Thu Oct 24 02:34:48 2019
New Revision: 353977
URL: https://svnweb.freebsd.org/changeset/base/353977

Log:
  MFC r345330: loader: fix loading of kernels with . in path
  
  The loader indended to search the kernel file name (only) for . but
  instead searched the entire path, so paths like
  "boot/test.elfv2/kernel" would not work.

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

Modified: stable/12/stand/common/load_elf.c
==============================================================================
--- stable/12/stand/common/load_elf.c	Thu Oct 24 02:33:57 2019	(r353976)
+++ stable/12/stand/common/load_elf.c	Thu Oct 24 02:34:48 2019	(r353977)
@@ -868,14 +868,16 @@ fake_modname(const char *name)
 		sp++;
 	else
 		sp = name;
-	ep = strrchr(name, '.');
-	if (ep) {
-		if (ep == name) {
-			sp = invalid_name;
-			ep = invalid_name + sizeof(invalid_name) - 1;
-		}
-	} else
-		ep = name + strlen(name);
+
+	ep = strrchr(sp, '.');
+	if (ep == NULL) {
+		ep = sp + strlen(sp);
+	}
+	if (ep == sp) {
+		sp = invalid_name;
+		ep = invalid_name + sizeof(invalid_name) - 1;
+	}
+
 	len = ep - sp;
 	fp = malloc(len + 1);
 	if (fp == NULL)


More information about the svn-src-all mailing list