Limit size of passed in data for utrace function.

Requested by: rwatson
Obtained from: NetBSD
This commit is contained in:
Alfred Perlstein 2001-01-06 09:34:20 +00:00
parent 0189f472ae
commit 0bad156a91
2 changed files with 4 additions and 0 deletions

View File

@ -48,6 +48,7 @@
#include <sys/ktrace.h>
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/sysent.h>
static MALLOC_DEFINE(M_KTRACE, "KTRACE", "KTRACE");
@ -359,6 +360,8 @@ utrace(curp, uap)
if (!KTRPOINT(p, KTR_USER))
return (0);
if (SCARG(uap, len) > KTR_USER_MAXLEN)
return (EINVAL);
p->p_traceflag |= KTRFAC_ACTIVE;
kth = ktrgetheader(KTR_USER);
MALLOC(cp, caddr_t, uap->len, M_KTRACE, M_WAITOK);

View File

@ -136,6 +136,7 @@ struct ktr_csw {
/*
* KTR_USER - data comming from userland
*/
#define KTR_USER_MAXLEN 2048 /* maximum length of passed data */
#define KTR_USER 7
/*