Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern mq_send1: fix argument validation and reject too la...



details:   https://anonhg.NetBSD.org/src/rev/29d7f15920b5
branches:  trunk
changeset: 455857:29d7f15920b5
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Apr 16 01:02:41 2019 +0000

description:
mq_send1: fix argument validation and reject too large lengths early.
Discovered by Andy Nguyen.

diffstat:

 sys/kern/sys_mqueue.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 902492d3155b -r 29d7f15920b5 sys/kern/sys_mqueue.c
--- a/sys/kern/sys_mqueue.c     Mon Apr 15 23:41:23 2019 +0000
+++ b/sys/kern/sys_mqueue.c     Tue Apr 16 01:02:41 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_mqueue.c,v 1.43 2018/08/19 15:10:23 jakllsch Exp $ */
+/*     $NetBSD: sys_mqueue.c,v 1.44 2019/04/16 01:02:41 martin Exp $   */
 
 /*
  * Copyright (c) 2007-2011 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.43 2018/08/19 15:10:23 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.44 2019/04/16 01:02:41 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -807,6 +807,8 @@
                return EINVAL;
 
        /* Allocate a new message */
+       if (msg_len > mq_max_msgsize)
+               return EMSGSIZE;
        size = sizeof(struct mq_msg) + msg_len;
        if (size > mq_max_msgsize)
                return EMSGSIZE;



Home | Main Index | Thread Index | Old Index