diff options
author | Eric van Gyzen <vangyzen@FreeBSD.org> | 2021-04-06 14:42:20 +0000 |
---|---|---|
committer | Eric van Gyzen <vangyzen@FreeBSD.org> | 2022-03-02 21:56:30 +0000 |
commit | f3629ca2f5557a5e2897dda74c6e362600916103 (patch) | |
tree | c8816da99f98280f5a40d80ff2f4a0e176f86a9d /usr.sbin/uefisign | |
parent | 858c11b39cc5619371ade0ab4237cca6e9bb2060 (diff) | |
download | src-f3629ca2f5557a5e2897dda74c6e362600916103.tar.gz src-f3629ca2f5557a5e2897dda74c6e362600916103.zip |
uefisign: handle empty sections
loader.efi has an empty set_Xfic section. Handle it correctly.
```
Sections:
Idx Name Size VMA LMA File off Algn
[...]
3 set_Xcom 00000168 00000000000d4000 00000000000d4000 000d0e00 2**2
CONTENTS, ALLOC, LOAD, DATA
4 set_Xfic 00000000 00000000000d4168 00000000000d4168 00000000 2**2
ALLOC, LOAD, DATA
5 .sdata 00000448 00000000000d5000 00000000000d5000 000d1000 2**2
CONTENTS, ALLOC, LOAD, DATA
[...]
```
Reviewed by: trasz, dab
Reported by: andy.y.liu@dell.com
Tested by: andy.y.liu@dell.com
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29606
(cherry picked from commit 12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28)
Diffstat (limited to 'usr.sbin/uefisign')
-rw-r--r-- | usr.sbin/uefisign/pe.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/uefisign/pe.c b/usr.sbin/uefisign/pe.c index 9f010e5d8a46..6459321441d8 100644 --- a/usr.sbin/uefisign/pe.c +++ b/usr.sbin/uefisign/pe.c @@ -244,7 +244,8 @@ parse_section_table(struct executable *x, off_t off, int number_of_sections) x->x_nsections = number_of_sections; for (i = 0; i < number_of_sections; i++) { - if (psh->psh_pointer_to_raw_data < x->x_headers_len) + if (psh->psh_size_of_raw_data > 0 && + psh->psh_pointer_to_raw_data < x->x_headers_len) errx(1, "section points inside the headers"); range_check(x, psh->psh_pointer_to_raw_data, |