Source-Changes-HG archive

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

[src/trunk]: src/sys/net Validate pgid arg to TIOCSPGRP



details:   https://anonhg.NetBSD.org/src/rev/582ceeb32078
branches:  trunk
changeset: 544153:582ceeb32078
user:      dsl <dsl%NetBSD.org@localhost>
date:      Thu Mar 13 10:24:38 2003 +0000

description:
Validate pgid arg to TIOCSPGRP

diffstat:

 sys/net/if_tun.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r df8181f8c03e -r 582ceeb32078 sys/net/if_tun.c
--- a/sys/net/if_tun.c  Thu Mar 13 10:20:06 2003 +0000
+++ b/sys/net/if_tun.c  Thu Mar 13 10:24:38 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tun.c,v 1.58 2002/12/25 08:40:20 jdolecek Exp $     */
+/*     $NetBSD: if_tun.c,v 1.59 2003/03/13 10:24:38 dsl Exp $  */
 
 /*
  * Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -15,7 +15,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.58 2002/12/25 08:40:20 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.59 2003/03/13 10:24:38 dsl Exp $");
 
 #include "tun.h"
 
@@ -542,6 +542,8 @@
 {
        int             s;
        struct tun_softc *tp;
+       pid_t pgid;
+       int error;
 
        tp = tun_find_unit(dev);
 
@@ -610,7 +612,13 @@
                break;
 
        case TIOCSPGRP:
-               tp->tun_pgrp = *(int *)data;
+               pgid = *(int *)data;
+               if (pgid != 0) {
+                       error = pgid_in_session(p, pgid);
+                       if (error != 0)
+                               return error;
+               }
+               tp->tun_pgrp = pgid;
                break;
 
        case TIOCGPGRP:



Home | Main Index | Thread Index | Old Index