From 06cee96130b552bf58d882bf86df29b9bc0ba33d Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 12 Nov 2002 21:18:21 +0000 Subject: Fix a "bug" in sysctl(8). Limit the length when we print a string from the kernel rather than ignoring the length and keeping on going till we finally hit a \0 character in the buffer. --- sbin/sysctl/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sbin/sysctl') diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index bb5c4c1..b712a26 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -533,7 +533,7 @@ show_var(int *oid, int nlen) case 'A': if (!nflag) printf("%s%s", name, sep); - printf("%s", p); + printf("%.*s", len, p); return (0); case 'I': -- cgit v1.1