diff options
| author | 2004-05-05 23:52:09 +0000 | |
|---|---|---|
| committer | 2004-05-05 23:52:09 +0000 | |
| commit | 9aeeba8da64d5e1f800a55af35dc030bc729b6d6 (patch) | |
| tree | cc1c3fe63cb5eef66948e7e76f515ea0cf7758c6 /sys/miscfs/procfs/procfs_status.c | |
| parent | better cleandir (diff) | |
| download | wireguard-openbsd-9aeeba8da64d5e1f800a55af35dc030bc729b6d6.tar.xz wireguard-openbsd-9aeeba8da64d5e1f800a55af35dc030bc729b6d6.zip | |
make sure uio_offset is a safe value, with suggestions from millert@
ok deraadt@ millert@
problem noticed by deprotect.com
Diffstat (limited to 'sys/miscfs/procfs/procfs_status.c')
| -rw-r--r-- | sys/miscfs/procfs/procfs_status.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/miscfs/procfs/procfs_status.c b/sys/miscfs/procfs/procfs_status.c index 5fb379cd861..0d1a117ffc0 100644 --- a/sys/miscfs/procfs/procfs_status.c +++ b/sys/miscfs/procfs/procfs_status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_status.c,v 1.7 2004/03/03 06:28:12 tedu Exp $ */ +/* $OpenBSD: procfs_status.c,v 1.8 2004/05/05 23:52:10 tedu Exp $ */ /* $NetBSD: procfs_status.c,v 1.11 1996/03/16 23:52:50 christos Exp $ */ /* @@ -165,16 +165,16 @@ procfs_dostatus(curp, p, pfs, uio) len = procfs_stat_gen(p, NULL, 0); ps = malloc(len, M_TEMP, M_WAITOK); - (void) procfs_stat_gen(p, ps, len); + len = procfs_stat_gen(p, ps, len); - len -= uio->uio_offset; - len = imin(len, uio->uio_resid); - if (len <= 0) + if (len <= uio->uio_offset) error = 0; - else + else { + len -= uio->uio_offset; + len = imin(len, uio->uio_resid); error = uiomove(ps + uio->uio_offset, len, uio); + } free(ps, M_TEMP); return (error); } - |
