Source-Changes-HG archive

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

[src/trunk]: src/sys/netisdn Don't allow the size of active diagnostics param...



details:   https://anonhg.NetBSD.org/src/rev/31dfc19e668a
branches:  trunk
changeset: 513613:31dfc19e668a
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Aug 05 11:16:56 2001 +0000

description:
Don't allow the size of active diagnostics parameter be bigger than
newly added I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN (currently 64KB).

diffstat:

 sys/netisdn/i4b_i4bdrv.c |  8 +++++++-
 sys/netisdn/i4b_ioctl.h  |  3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 400c9aae6a71 -r 31dfc19e668a sys/netisdn/i4b_i4bdrv.c
--- a/sys/netisdn/i4b_i4bdrv.c  Sun Aug 05 11:14:21 2001 +0000
+++ b/sys/netisdn/i4b_i4bdrv.c  Sun Aug 05 11:16:56 2001 +0000
@@ -27,7 +27,7 @@
  *     i4b_i4bdrv.c - i4b userland interface driver
  *     --------------------------------------------
  *
- *     $Id: i4b_i4bdrv.c,v 1.4 2001/04/21 07:23:41 martin Exp $ 
+ *     $Id: i4b_i4bdrv.c,v 1.5 2001/08/05 11:16:56 jdolecek Exp $ 
  *
  * $FreeBSD$
  *
@@ -834,6 +834,12 @@
 
                        if(req.in_param_len)
                        {
+                               /* XXX arbitrary limit */
+                               if (req.in_param_len > I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN) {
+                                       error = EINVAL;
+                                       goto diag_done;
+                               }
+
                                req.in_param = malloc(r->in_param_len, M_DEVBUF, M_WAITOK);
 
                                if(!req.in_param)
diff -r 400c9aae6a71 -r 31dfc19e668a sys/netisdn/i4b_ioctl.h
--- a/sys/netisdn/i4b_ioctl.h   Sun Aug 05 11:14:21 2001 +0000
+++ b/sys/netisdn/i4b_ioctl.h   Sun Aug 05 11:16:56 2001 +0000
@@ -27,7 +27,7 @@
  *     i4b_ioctl.h - messages kernel <--> userland
  *     -------------------------------------------
  *
- *     $Id: i4b_ioctl.h,v 1.1.1.1 2001/01/05 12:49:56 martin Exp $ 
+ *     $Id: i4b_ioctl.h,v 1.2 2001/08/05 11:16:56 jdolecek Exp $ 
  *
  * $FreeBSD$
  *
@@ -688,6 +688,7 @@
        int controller;         /* controller number */
        u_int32_t cmd;          /* diagnostic command to execute */
        size_t in_param_len;    /* length of additional input parameter */
+#define I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN      65536
        void *in_param;         /* optional input parameter */
        size_t out_param_len;   /* available output space */
        void *out_param;        /* output data goes here */



Home | Main Index | Thread Index | Old Index