diff options
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r-- | sys/arch/hppa/stand/mkboot/mkboot.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/arch/hppa/stand/mkboot/mkboot.c b/sys/arch/hppa/stand/mkboot/mkboot.c index de84d6b6f44..0dd57973acb 100644 --- a/sys/arch/hppa/stand/mkboot/mkboot.c +++ b/sys/arch/hppa/stand/mkboot/mkboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkboot.c,v 1.18 2014/01/22 09:18:04 jsing Exp $ */ +/* $OpenBSD: mkboot.c,v 1.19 2014/09/24 00:13:13 doug Exp $ */ /* * Copyright (c) 1990, 1993 @@ -204,10 +204,11 @@ putfile(char *from_file, int to) if (n != sizeof (elf_header)) err(1, "%s: reading ELF header", from_file); header_count = ntohs(elf_header.e_phnum); - memory_needed = header_count * sizeof (*elf_segments); - elf_segments = malloc(memory_needed); + elf_segments = reallocarray(NULL, header_count, + sizeof(*elf_segments)); if (elf_segments == NULL) err(1, "malloc"); + memory_needed = header_count * sizeof(*elf_segments); (void) lseek(from, ntohl(elf_header.e_phoff), SEEK_SET); n = read(from, elf_segments, memory_needed); if (n != memory_needed) |