Skip to content

Commit d6ab2b7

Browse files
committed
Increase path for the ELF interpreter
Modern OS like NixOS can have long paths for everything. Increase the size of the buffer for reading in the interpreter. This does not address adding more interpreters to accomodate more distributions. But make it possible.
1 parent 792db88 commit d6ab2b7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ChangeLog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- Update the trust-db filter rules to add and drop some things
44
- Add new magic detections and drop a lot of old rules
55
- Performance improvement looking up mime-types
6-
- Various clode cleanups, hardening, and performance optimizing
6+
- Various code cleanups, hardening, and performance optimizing
77
- Classify ELF files with an unknown interpreter as application/x-bad-elf
88
- Consolidate the fapolicyd-cli return codes
99

src/library/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ uint32_t gather_elf(int fd, off_t size)
14031403
// Obtain program interpreter from ELF object file
14041404
if (ph_tbl[i].p_type == PT_INTERP) {
14051405
uint32_t len;
1406-
char interp[65];
1406+
char interp[385];
14071407
uint32_t filesz = ph_tbl[i].p_filesz;
14081408
uint32_t offset = ph_tbl[i].p_offset;
14091409

@@ -1412,7 +1412,7 @@ uint32_t gather_elf(int fd, off_t size)
14121412
!= offset)
14131413
goto err_out32;
14141414

1415-
len = (filesz < 65 ? filesz : 65);
1415+
len = (filesz < 385 ? filesz : 385);
14161416

14171417
if ((unsigned int) safe_read(fd, (char *)
14181418
interp, len) != len)
@@ -1558,7 +1558,7 @@ uint32_t gather_elf(int fd, off_t size)
15581558
// Obtain program interpreter from ELF object file
15591559
if (ph_tbl[i].p_type == PT_INTERP) {
15601560
uint64_t len;
1561-
char interp[65];
1561+
char interp[385];
15621562
uint64_t filesz = ph_tbl[i].p_filesz;
15631563
uint64_t offset = ph_tbl[i].p_offset;
15641564

@@ -1567,7 +1567,7 @@ uint32_t gather_elf(int fd, off_t size)
15671567
!= offset)
15681568
goto err_out64;
15691569

1570-
len = (filesz < 65 ? filesz : 65);
1570+
len = (filesz < 385 ? filesz : 385);
15711571

15721572
if ((unsigned int) safe_read(fd, (char *)
15731573
interp, len) != len)

0 commit comments

Comments
 (0)