diff options
author | phk <phk@FreeBSD.org> | 2008-03-22 16:32:52 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2008-03-22 16:32:52 +0000 |
commit | 5a1f4173f593acdd28aaddd12d95b36a0dba6977 (patch) | |
tree | 4bfd5cd0c38156953b4b1db30dea8e30d1c69526 /sys/kern | |
parent | 9eb2a09a7ead1fbf9bb1d02c9d5d1b3fc508ec0a (diff) | |
download | FreeBSD-src-5a1f4173f593acdd28aaddd12d95b36a0dba6977.zip FreeBSD-src-5a1f4173f593acdd28aaddd12d95b36a0dba6977.tar.gz |
In abort2(2): Accept a NULL arg pointer if nargs == 0
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_exit.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index d2e22e9..d0d487d 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -570,11 +570,13 @@ abort2(struct thread *td, struct abort2_args *uap) /* Prevent from DoSes from user-space. */ if (uap->nargs < 0 || uap->nargs > 16) goto out; - if (uap->args == NULL) - goto out; - error = copyin(uap->args, uargs, uap->nargs * sizeof(void *)); - if (error != 0) - goto out; + if (uap->nargs > 0) { + if (uap->args == NULL) + goto out; + error = copyin(uap->args, uargs, uap->nargs * sizeof(void *)); + if (error != 0) + goto out; + } /* * Limit size of 'reason' string to 128. Will fit even when * maximal number of arguments was chosen to be logged. @@ -586,7 +588,7 @@ abort2(struct thread *td, struct abort2_args *uap) } else { sbuf_printf(sb, "(null)"); } - if (uap->nargs) { + if (uap->nargs > 0) { sbuf_printf(sb, "("); for (i = 0;i < uap->nargs; i++) sbuf_printf(sb, "%s%p", i == 0 ? "" : ", ", uargs[i]); |