Skip to content

Commit

Permalink
loader: fix loading of kernels with . in path
Browse files Browse the repository at this point in the history
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.

Submitted by:	alfredo.junior_eldorado.org.br
Reviewed by:	kevans
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19658
  • Loading branch information
emaste committed Mar 20, 2019
1 parent 609c32a commit d81c7cf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions stand/common/load_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d81c7cf

Please sign in to comment.