Index: linux_misc.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_misc.c,v retrieving revision 1.77.2.3 retrieving revision 1.77.2.4 diff -u -r1.77.2.3 -r1.77.2.4 --- linux_misc.c 2000/07/20 05:31:56 1.77.2.3 +++ linux_misc.c 2000/07/30 05:36:11 1.77.2.4 @@ -954,6 +954,8 @@ tv[1].tv_usec = 0; /* so that utimes can copyin */ tvp = (struct timeval *)stackgap_alloc(&sg, sizeof(tv)); + if (tvp == NULL) + return (ENAMETOOLONG); if ((error = copyout(tv, tvp, sizeof(tv)))) return error; bsdutimes.tptr = tvp; Index: linux_util.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_util.c,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- linux_util.c 2000/07/07 01:23:45 1.9.2.1 +++ linux_util.c 2000/07/30 05:36:11 1.9.2.2 @@ -162,7 +162,10 @@ else { sz = &ptr[len] - buf; *pbuf = stackgap_alloc(sgp, sz + 1); - error = copyout(buf, *pbuf, sz); + if (*pbuf != NULL) + error = copyout(buf, *pbuf, sz); + else + error = ENAMETOOLONG; free(buf, M_TEMP); } Index: linux_util.h =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_util.h,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -r1.10 -r1.10.2.1 --- linux_util.h 1999/12/04 11:10:22 1.10 +++ linux_util.h 2000/07/30 05:36:11 1.10.2.1 @@ -56,29 +56,27 @@ static __inline caddr_t stackgap_init(void); static __inline void *stackgap_alloc(caddr_t *, size_t); +#define szsigcode (*(curproc->p_sysent->sv_szsigcode)) + static __inline caddr_t stackgap_init() { -#define szsigcode (*(curproc->p_sysent->sv_szsigcode)) return (caddr_t)(PS_STRINGS - szsigcode - SPARE_USRSPACE); } - static __inline void * stackgap_alloc(sgp, sz) caddr_t *sgp; size_t sz; { - void *p = (void *) *sgp; - *sgp += ALIGN(sz); + void *p = (void *) *sgp; + + sz = ALIGN(sz); + if (*sgp + sz > (caddr_t)(PS_STRINGS - szsigcode)) + return NULL; + *sgp += sz; return p; } - -#ifdef DEBUG_LINUX -#define DPRINTF(a) printf a; -#else -#define DPRINTF(a) -#endif extern const char linux_emul_path[];