Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164790861
D35868.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35868.diff
View Options
diff --git a/usr.bin/etdump/etdump.c b/usr.bin/etdump/etdump.c
--- a/usr.bin/etdump/etdump.c
+++ b/usr.bin/etdump/etdump.c
@@ -116,8 +116,8 @@
}
static int
-dump_section(char *buffer, size_t offset, FILE *outfile, const char *filename,
- struct outputter *outputter)
+dump_section(char *buffer, size_t bufsize, size_t offset, FILE *outfile,
+ const char *filename, struct outputter *outputter)
{
boot_catalog_section_header *sh;
u_char platform_id;
@@ -125,6 +125,8 @@
size_t entry_offset;
boot_catalog_section_entry *entry;
+ if (offset + sizeof(boot_catalog_section_header) > bufsize)
+ errx(1, "%s: section header out of bounds", filename);
sh = (boot_catalog_section_header *)&buffer[offset];
if (outputter->output_section != NULL) {
outputter->output_section(outfile, filename, sh);
@@ -135,6 +137,10 @@
if (outputter->output_entry != NULL) {
for (i = 1; i <= (int)sh->num_section_entries[0]; i++) {
entry_offset = offset + i * ET_BOOT_ENTRY_SIZE;
+ if (entry_offset + sizeof(boot_catalog_section_entry) >
+ bufsize)
+ errx(1, "%s: section entry out of bounds",
+ filename);
entry =
(boot_catalog_section_entry *)&buffer[entry_offset];
outputter->output_entry(outfile, filename, entry,
@@ -195,8 +201,8 @@
(uint8_t)entry[0] != ET_SECTION_HEADER_LAST)
break;
- entry_count = dump_section(buffer, offset, outfile, filename,
- outputter);
+ entry_count = dump_section(buffer, sizeof(buffer), offset,
+ outfile, filename, outputter);
offset += entry_count * ET_BOOT_ENTRY_SIZE;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 5, 1:56 AM (8 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35980360
Default Alt Text
D35868.diff (1 KB)
Attached To
Mode
D35868: etdump: exit on error if section header or entry offset is OOB
Attached
Detach File
Event Timeline
Log In to Comment