diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-05-05 23:52:11 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-05-05 23:52:11 +0000 |
commit | c7bd171a110dc759928d58a928869b7e355969c2 (patch) | |
tree | ee7900fd3f27674c3f98e4cc4b2038b8fc2c7fe1 /sys/miscfs/procfs/procfs_cmdline.c | |
parent | 9fa54860a762e0b9de75773b73d02d619703f634 (diff) |
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_cmdline.c')
-rw-r--r-- | sys/miscfs/procfs/procfs_cmdline.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/miscfs/procfs/procfs_cmdline.c b/sys/miscfs/procfs/procfs_cmdline.c index b4f3de9858c..c23a733045e 100644 --- a/sys/miscfs/procfs/procfs_cmdline.c +++ b/sys/miscfs/procfs/procfs_cmdline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_cmdline.c,v 1.3 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: procfs_cmdline.c,v 1.4 2004/05/05 23:52:09 tedu Exp $ */ /* $NetBSD: procfs_cmdline.c,v 1.3 1999/03/13 22:26:48 thorpej Exp $ */ /* @@ -83,11 +83,10 @@ procfs_docmdline(curp, p, pfs, uio) */ if (P_ZOMBIE(p) || (p->p_flag & P_SYSTEM) != 0) { len = snprintf(arg, PAGE_SIZE, "(%s)", p->p_comm); - xlen = len - uio->uio_offset; - if (xlen <= 0) + if (uio->uio_offset >= (off_t)len) error = 0; else - error = uiomove(arg, xlen, uio); + error = uiomove(arg, len - uio->uio_offset, uio); free(arg, M_TEMP); return (error); |