summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2016-09-01 14:12:08 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2016-09-01 14:12:08 +0000
commit1c07735427a52bc1eb210218c2339da49db0cd74 (patch)
treee6de2528b627049ece7ea35824311051c567c79c /sbin
parent2dd43fb3cf71888a5e52bfd1b6d332feda73a2de (diff)
make the version symbol a fixed size (512) to reduce the potential for
bad effects when savecore reads beyond it ok deraadt (and thanks to bluhm for remembering that this happens)
Diffstat (limited to 'sbin')
-rw-r--r--sbin/savecore/savecore.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 45cf7a0c490..a96c618c621 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: savecore.c,v 1.56 2016/07/04 04:05:29 guenther Exp $ */
+/* $OpenBSD: savecore.c,v 1.57 2016/09/01 14:12:07 tedu Exp $ */
/* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */
/*-
@@ -89,6 +89,8 @@ struct nlist dump_nl[] = { /* Name list for dumped system. */
{ NULL },
};
+#define VERSIONSIZE 512
+
/* Types match kernel declarations. */
long dumplo; /* where dump starts on dumpdev (in blocks) */
off_t dumpoff; /* where dump starts on dumpdev (in bytes) */
@@ -105,7 +107,7 @@ kvm_t *kd_dump; /* kvm descriptor on block dev */
time_t now; /* current date */
char panic_mesg[1024];
int panicstr;
-char vers[1024];
+char vers[VERSIONSIZE];
int clear, zcompress, force, verbose; /* flags */
@@ -294,7 +296,7 @@ check_kmem(void)
{
char *cp;
int panicloc;
- char core_vers[1024];
+ char core_vers[VERSIONSIZE];
if (kvm_read(kd_dump, dump_nl[X_VERSION].n_value, core_vers,
sizeof(core_vers)) != sizeof(core_vers)) {