diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dmesg/dmesg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c index 6c30f1a0c86..4d63370e9ab 100644 --- a/sbin/dmesg/dmesg.c +++ b/sbin/dmesg/dmesg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dmesg.c,v 1.30 2018/05/15 15:15:50 cheloha Exp $ */ +/* $OpenBSD: dmesg.c,v 1.31 2019/12/24 13:20:44 bluhm Exp $ */ /* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */ /*- @@ -39,6 +39,7 @@ #include <kvm.h> #include <limits.h> #include <nlist.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -99,7 +100,7 @@ main(int argc, char *argv[]) err(1, "sysctl: %s", startupmsgs ? "KERN_CONSBUFSIZE" : "KERN_MSGBUFSIZE"); - msgbufsize += sizeof(struct msgbuf) - 1; + msgbufsize += offsetof(struct msgbuf, msg_bufc); allocated = bufdata = calloc(1, msgbufsize); if (bufdata == NULL) errx(1, "couldn't allocate space for buffer data"); |