diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-04-07 23:37:06 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-04-07 23:37:06 +0000 |
commit | 28bb5711ca1f1a4f968ef4b2a03f481009170f98 (patch) | |
tree | 79a7b17ae6d405b8fd90336ffe043b78fdfd7cd3 /sys/miscfs/kernfs | |
parent | a0871c3edd93358520dd4646a210b3b3631ce98a (diff) |
some snprintf usage from rohee.
Diffstat (limited to 'sys/miscfs/kernfs')
-rw-r--r-- | sys/miscfs/kernfs/kernfs_vnops.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c index 383bb5df40b..be1af6e7242 100644 --- a/sys/miscfs/kernfs/kernfs_vnops.c +++ b/sys/miscfs/kernfs/kernfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kernfs_vnops.c,v 1.30 2003/03/30 22:28:05 rohee Exp $ */ +/* $OpenBSD: kernfs_vnops.c,v 1.31 2003/04/07 23:37:05 tedu Exp $ */ /* $NetBSD: kernfs_vnops.c,v 1.43 1996/03/16 23:52:47 christos Exp $ */ /* @@ -329,24 +329,24 @@ kernfs_xread(kt, off, bufp, len) struct timeval tv; microtime(&tv); - sprintf(*bufp, "%ld %ld\n", tv.tv_sec, tv.tv_usec); + snprintf(*bufp, len, "%ld %ld\n", tv.tv_sec, tv.tv_usec); break; } case KTT_INT: { int *ip = kt->kt_data; - sprintf(*bufp, "%d\n", *ip); + snprintf(*bufp, len, "%d\n", *ip); break; } case KTT_STRING: { char *cp = kt->kt_data; - size_t len = strlen(cp); + size_t end = strlen(cp); - if (len && cp[len - 1] != '\n') { - strlcpy(*bufp, cp, KSTRING - 1); - strlcat(*bufp, "\n", KSTRING); + if (end && cp[end - 1] != '\n') { + strlcpy(*bufp, cp, len - 1); + strlcat(*bufp, "\n", len); } else *bufp = cp; @@ -414,17 +414,17 @@ kernfs_xread(kt, off, bufp, len) case KTT_AVENRUN: averunnable.fscale = FSCALE; - sprintf(*bufp, "%d %d %d %ld\n", + snprintf(*bufp, len, "%d %d %d %ld\n", averunnable.ldavg[0], averunnable.ldavg[1], averunnable.ldavg[2], averunnable.fscale); break; case KTT_USERMEM: - sprintf(*bufp, "%u\n", ctob(physmem - uvmexp.wired)); + snprintf(*bufp, len, "%u\n", ctob(physmem - uvmexp.wired)); break; case KTT_PHYSMEM: - sprintf(*bufp, "%u\n", ctob(physmem)); + snprintf(*bufp, len, "%u\n", ctob(physmem)); break; #ifdef IPSEC |