Date: Thu, 24 Oct 2019 02:34:48 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353977 - stable/12/stand/common Message-ID: <201910240234.x9O2Ymbk087579@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910240234.x9O2Ymbk087579>