summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2015-10-16 13:54:45 +0000
committertobias <tobias@openbsd.org>2015-10-16 13:54:45 +0000
commit4497e20808fcf8a7ec1b3b5c697ae9b85db6a4f8 (patch)
treec47c7393047cfdd6b29b2785e3969366c89367f7 /lib/libc
parentPut tls_config_verify_client_optional() in the right place. (diff)
downloadwireguard-openbsd-4497e20808fcf8a7ec1b3b5c697ae9b85db6a4f8.tar.xz
wireguard-openbsd-4497e20808fcf8a7ec1b3b5c697ae9b85db6a4f8.zip
Merge nlist out of boundary access fix with other nlist implementations.
While at it, merge style and typo fixes back into nlist(3), too. ok deraadt, jsing, millert
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/nlist.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c
index f9666265c66..437640732d1 100644
--- a/lib/libc/gen/nlist.c
+++ b/lib/libc/gen/nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nlist.c,v 1.63 2015/10/16 07:40:12 tobias Exp $ */
+/* $OpenBSD: nlist.c,v 1.64 2015/10/16 13:54:45 tobias Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -71,7 +71,7 @@ __elf_is_okay__(Elf_Ehdr *ehdr)
ehdr->e_ident[EI_DATA] == ELF_TARG_DATA &&
ehdr->e_ident[EI_VERSION] == ELF_TARG_VER) {
- /* Now check the machine dependant header */
+ /* Now check the machine dependent header */
if (ehdr->e_machine == ELF_TARG_MACH &&
ehdr->e_version == ELF_TARG_VER)
retval = 1;
@@ -120,7 +120,8 @@ __fdnlist(int fd, struct nlist *list)
if ((shdr = malloc(shdr_size)) == NULL)
return (-1);
- if (pread(fd, shdr, shdr_size, (off_t)ehdr.e_shoff) != shdr_size) {
+ if (pread(fd, shdr, shdr_size, (off_t)ehdr.e_shoff) !=
+ shdr_size) {
free(shdr);
return (-1);
}
@@ -190,7 +191,8 @@ __fdnlist(int fd, struct nlist *list)
if (usemalloc) {
if ((strtab = malloc(symstrsize)) == NULL)
return (-1);
- if (pread(fd, strtab, symstrsize, (off_t)symstroff) != symstrsize) {
+ if (pread(fd, strtab, symstrsize, (off_t)symstroff) !=
+ symstrsize) {
free(strtab);
return (-1);
}
@@ -267,8 +269,7 @@ __fdnlist(int fd, struct nlist *list)
p->n_type = N_FN;
break;
}
- if (ELF_ST_BIND(s->st_info) ==
- STB_LOCAL)
+ if (ELF_ST_BIND(s->st_info) == STB_LOCAL)
p->n_type = N_EXT;
p->n_desc = 0;
p->n_other = 0;