lkml.org 
[lkml]   [2020]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Bug fix to ELF Loader which rejects valid ELFs
On Tue, Aug 11, 2020 at 02:44:08PM +0000, Burrow, Ryan - 0553 - MITLL wrote:
> /* Sanity check the number of program headers... */
> - /* ...and their total size. */
> - size = sizeof(struct elf_phdr) * elf_ex->e_phnum;
> - if (size == 0 || size > 65536 || size > ELF_MIN_ALIGN)
> + if (elf_ex->e_phnum == 0 || elf_ex->phnum > 65535)

umm, did you compile-test this?

assuming you meant e_phnum, it's a 16-bit quantity, so it can't be bigger
than 65535.

> goto out;
>
> + size = sizeof(struct elf_phdr) * elf_ex->e_phnum;

use array_size() here?



\
 
 \ /
  Last update: 2020-08-11 17:06    [W:0.042 / U:1.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site