diff options
Diffstat (limited to 'kexec/kexec-elf.c')
-rw-r--r-- | kexec/kexec-elf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c index 3515203..1d6320a 100644 --- a/kexec/kexec-elf.c +++ b/kexec/kexec-elf.c @@ -720,6 +720,14 @@ static int build_mem_notes(struct mem_ehdr *ehdr) desc = note + note_size; note_size += _ALIGN(hdr.n_descsz, 4); + if (((note+note_size) > note_end) || + ((note+note_size) < note_start)) { + /* Something is very wrong here ! Most likely the note + * header is invalid */ + fprintf(stderr, "ELF Note corrupted !\n"); + return -1; + } + if ((hdr.n_namesz != 0) && (name[hdr.n_namesz -1] != '\0')) { /* If note name string is not null terminated, just * warn user about it and continue processing. This |