From: jsg Date: Sat, 3 Feb 2024 00:38:08 +0000 (+0000) Subject: correct buffer size argument to snprintf in print_proto() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b8e36cff4f6269663bab72388311c2ad7591bfa9;p=openbsd correct buffer size argument to snprintf in print_proto() found by "snprintf() is printing too much 8192 vs 1024" smatch error ok tobhe@ stsp@ --- diff --git a/sbin/iked/util.c b/sbin/iked/util.c index c3c0c3e2900..2cd34d12b7c 100644 --- a/sbin/iked/util.c +++ b/sbin/iked/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.43 2023/07/28 11:23:03 claudio Exp $ */ +/* $OpenBSD: util.c,v 1.44 2024/02/03 00:38:08 jsg Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -701,8 +701,7 @@ print_proto(uint8_t proto) if ((p = getprotobynumber(proto)) != NULL) strlcpy(buf[idx], p->p_name, sizeof(buf[idx])); else - snprintf(buf[idx], sizeof(buf), "%u", proto); - + snprintf(buf[idx], sizeof(buf[idx]), "%u", proto); return (buf[idx++]); }