From 2aed95157eef9b3189b281b0e6d2aad7e25aca08 Mon Sep 17 00:00:00 2001 From: tobhe Date: Mon, 17 May 2021 08:14:37 +0000 Subject: [PATCH] Avoid calling ibuf_add() with NULL and zero length. ok patrick@ --- sbin/iked/imsg_util.c | 7 +++++-- 1 file 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 @@ -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); -- 2.20.1