Module Name:    src
Committed By:   pooka
Date:           Tue Mar  8 21:36:01 UTC 2011

Modified Files:
        src/lib/librumphijack: hijack.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/lib/librumphijack/hijack.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.75 src/lib/librumphijack/hijack.c:1.76
--- src/lib/librumphijack/hijack.c:1.75	Tue Mar  8 20:59:01 2011
+++ src/lib/librumphijack/hijack.c	Tue Mar  8 21:36:01 2011
@@ -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;
 			}
 		}

Reply via email to