diff options
author | tobhe <tobhe@cvs.openbsd.org> | 2021-05-17 08:14:38 +0000 |
---|---|---|
committer | tobhe <tobhe@cvs.openbsd.org> | 2021-05-17 08:14:38 +0000 |
commit | 83609c1a58de375b58dcf6c3280c46cf538666f9 (patch) | |
tree | 3c855e3421a3445d6924640b5196690a48198796 /sbin | |
parent | d4cb904761bcdb84090f56a46d086d45fdc47c63 (diff) |
Avoid calling ibuf_add() with NULL and zero length.
ok patrick@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/iked/imsg_util.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/iked/imsg_util.c b/sbin/iked/imsg_util.c index 90b7f6e6231..2f0ee324ed4 100644 --- a/sbin/iked/imsg_util.c +++ b/sbin/iked/imsg_util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg_util.c,v 1.12 2019/11/30 15:44:07 tobhe Exp $ */ +/* $OpenBSD: imsg_util.c,v 1.13 2021/05/17 08:14:37 tobhe Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -59,7 +59,10 @@ ibuf_new(const void *data, size_t len) ibuf_zero(buf); - if (data == NULL && len) { + if (len == 0) + return (buf); + + if (data == NULL) { if (ibuf_advance(buf, len) == NULL) { ibuf_free(buf); return (NULL); |