Stanislav Ochotnicky 24ae88
From 94578ce4b228417c8130690128cdbdab90cc04d9 Mon Sep 17 00:00:00 2001
Stanislav Ochotnicky ca084f
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
Stanislav Ochotnicky 24ae88
Date: Tue, 1 Feb 2011 18:19:33 +0100
Stanislav Ochotnicky 24ae88
Subject: [PATCH] execve path warning
Stanislav Ochotnicky ca084f
Stanislav Ochotnicky ca084f
---
Stanislav Ochotnicky 24ae88
 src/native/unix/native/jsvc-unix.c |    8 ++++++++
Stanislav Ochotnicky 24ae88
 1 files changed, 8 insertions(+), 0 deletions(-)
Stanislav Ochotnicky ca084f
Stanislav Ochotnicky ca084f
diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c
Stanislav Ochotnicky 24ae88
index 6f39365..ccd5d99 100644
Stanislav Ochotnicky ca084f
--- a/src/native/unix/native/jsvc-unix.c
Stanislav Ochotnicky ca084f
+++ b/src/native/unix/native/jsvc-unix.c
Stanislav Ochotnicky 24ae88
@@ -702,6 +702,14 @@ int main(int argc, char *argv[]) {
Stanislav Ochotnicky ca084f
         char *p1=NULL;
Stanislav Ochotnicky ca084f
         char *p2=NULL;
Stanislav Ochotnicky ca084f
 
Stanislav Ochotnicky ca084f
+        /* We don't want to use a form of exec() that searches the
Stanislav Ochotnicky ca084f
+           PATH, so require that argv[0] be either an absolute or
Stanislav Ochotnicky ca084f
+           relative path.  Error out if this isn't the case.  */
Stanislav Ochotnicky 24ae88
+        if (strchr(argv[0],'/') == NULL) {
Stanislav Ochotnicky ca084f
+          log_error("JSVC re-exec requires execution with an absolute or relative path");
Stanislav Ochotnicky ca084f
+          return(1);
Stanislav Ochotnicky ca084f
+        }
Stanislav Ochotnicky ca084f
+
Stanislav Ochotnicky ca084f
         /*
Stanislav Ochotnicky ca084f
          * There is no need to change LD_LIBRARY_PATH
Stanislav Ochotnicky ca084f
          * if we were not able to find a path to libjvm.so
Stanislav Ochotnicky ca084f
-- 
Stanislav Ochotnicky 24ae88
1.7.3.5
Stanislav Ochotnicky ca084f