From: Ben Gras Date: Thu, 5 Feb 2009 13:00:03 +0000 (+0000) Subject: fix compiler warning; missing memory range check X-Git-Tag: v3.1.4~115 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/zpipe.c?a=commitdiff_plain;h=6e86e6706dadd569567e072e7384a23a688a8ce6;p=minix.git fix compiler warning; missing memory range check --- diff --git a/kernel/system/do_getinfo.c b/kernel/system/do_getinfo.c index 6f01e0582..5c4062e10 100644 --- a/kernel/system/do_getinfo.c +++ b/kernel/system/do_getinfo.c @@ -9,6 +9,8 @@ * m1_i2: I_VAL_LEN2_E (second length or process nr) */ +#include + #include "../system.h" #include "../vm.h" diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index f4f0c3a32..1b2b92a76 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -9,6 +9,7 @@ */ #include "../system.h" +#include "../vm.h" #include #include #include @@ -28,11 +29,16 @@ message *m_ptr; /* pointer to request message */ struct sigcontext sc, *scp; struct sigframe fr, *frp; int proc, r; + phys_bytes ph; if (!isokendpt(m_ptr->SIG_ENDPT, &proc)) return(EINVAL); if (iskerneln(proc)) return(EPERM); rp = proc_addr(proc); + ph = umap_local(proc_addr(who_p), D, (vir_bytes) m_ptr->SIG_CTXT_PTR, sizeof(struct sigmsg)); + if(!ph) return EFAULT; + CHECKRANGE_OR_SUSPEND(proc_addr(who_p), ph, sizeof(struct sigmsg), 1); + /* Get the sigmsg structure into our address space. */ if((r=data_copy(who_e, (vir_bytes) m_ptr->SIG_CTXT_PTR, SYSTEM, (vir_bytes) &smsg, (phys_bytes) sizeof(struct sigmsg))) != OK) @@ -53,6 +59,9 @@ message *m_ptr; /* pointer to request message */ sc.sc_flags = 0; /* unused at this time */ sc.sc_mask = smsg.sm_mask; + ph = umap_local(rp, D, (vir_bytes) scp, sizeof(struct sigcontext)); + if(!ph) return EFAULT; + CHECKRANGE_OR_SUSPEND(rp, ph, sizeof(struct sigcontext), 1); /* Copy the sigcontext structure to the user's stack. */ if((r=data_copy(SYSTEM, (vir_bytes) &sc, m_ptr->SIG_ENDPT, (vir_bytes) scp, (vir_bytes) sizeof(struct sigcontext))) != OK) @@ -69,6 +78,9 @@ message *m_ptr; /* pointer to request message */ fr.sf_signo = smsg.sm_signo; fr.sf_retadr = (void (*)()) smsg.sm_sigreturn; + ph = umap_local(rp, D, (vir_bytes) frp, sizeof(struct sigframe)); + if(!ph) return EFAULT; + CHECKRANGE_OR_SUSPEND(rp, ph, sizeof(struct sigframe), 1); /* Copy the sigframe structure to the user's stack. */ if((r=data_copy(SYSTEM, (vir_bytes) &fr, m_ptr->SIG_ENDPT, (vir_bytes) frp, (vir_bytes) sizeof(struct sigframe))) != OK)