Source-Changes-HG archive

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

[src/trunk]: src/lib/librumphijack Enforce that the path=/rump specifier spec...



details:   https://anonhg.NetBSD.org/src/rev/34efa7b62e87
branches:  trunk
changeset: 763039:34efa7b62e87
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Mar 08 21:36:01 2011 +0000

description:
Enforce that the path=/rump specifier specifies and actual path
prefix and doesn't accept e.g. /rumpdev (only /rump/dev).

diffstat:

 lib/librumphijack/hijack.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 71b2a265b474 -r 34efa7b62e87 lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c        Tue Mar 08 21:09:18 2011 +0000
+++ b/lib/librumphijack/hijack.c        Tue Mar 08 21:36:01 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijack.c,v 1.75 2011/03/08 20:59:01 pooka Exp $       */
+/*      $NetBSD: hijack.c,v 1.76 2011/03/08 21:36:01 pooka Exp $       */
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: hijack.c,v 1.75 2011/03/08 20:59:01 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.76 2011/03/08 21:36:01 pooka Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -692,14 +692,18 @@
 static enum pathtype
 path_isrump(const char *path)
 {
+       size_t plen;
        int i;
 
        if (rumpprefix == NULL && nblanket == 0)
                return PATH_HOST;
 
        if (*path == '/') {
-               if (rumpprefix) {
-                       if (strncmp(path, rumpprefix, rumpprefixlen) == 0) {
+               plen = strlen(path);
+               if (rumpprefix && plen >= rumpprefixlen) {
+                       if (strncmp(path, rumpprefix, rumpprefixlen) == 0
+                           && (plen == rumpprefixlen
+                             || *(path + rumpprefixlen) == '/')) {
                                return PATH_RUMP;
                        }
                }



Home | Main Index | Thread Index | Old Index