From fe6a87c8fb7d5ce5eca5acc11c5bb47f8478075b Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Wed, 14 Jun 2017 03:00:41 +0000 Subject: tweak sysctl_string and sysctl_tstring to use size_t for lengths, not int theyre both wrappers around sysctl__string, which is where half the fix is too. --- sys/kern/kern_sysctl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 13024bf6ecb..16d1d279036 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.327 2017/06/13 06:16:31 dlg Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.328 2017/06/14 03:00:40 dlg Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -928,23 +928,24 @@ sysctl_rdquad(void *oldp, size_t *oldlenp, void *newp, int64_t val) */ int sysctl_string(void *oldp, size_t *oldlenp, void *newp, size_t newlen, char *str, - int maxlen) + size_t maxlen) { return sysctl__string(oldp, oldlenp, newp, newlen, str, maxlen, 0); } int sysctl_tstring(void *oldp, size_t *oldlenp, void *newp, size_t newlen, - char *str, int maxlen) + char *str, size_t maxlen) { return sysctl__string(oldp, oldlenp, newp, newlen, str, maxlen, 1); } int sysctl__string(void *oldp, size_t *oldlenp, void *newp, size_t newlen, - char *str, int maxlen, int trunc) + char *str, size_t maxlen, int trunc) { - int len, error = 0; + size_t len; + int error = 0; len = strlen(str) + 1; if (oldp && *oldlenp < len) { -- cgit v1.2.3