Blob Blame History Raw
From 94578ce4b228417c8130690128cdbdab90cc04d9 Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
Date: Tue, 1 Feb 2011 18:19:33 +0100
Subject: [PATCH] execve path warning

---
 src/native/unix/native/jsvc-unix.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c
index 6f39365..ccd5d99 100644
--- a/src/native/unix/native/jsvc-unix.c
+++ b/src/native/unix/native/jsvc-unix.c
@@ -702,6 +702,14 @@ int main(int argc, char *argv[]) {
         char *p1=NULL;
         char *p2=NULL;
 
+        /* We don't want to use a form of exec() that searches the
+           PATH, so require that argv[0] be either an absolute or
+           relative path.  Error out if this isn't the case.  */
+        if (strchr(argv[0],'/') == NULL) {
+          log_error("JSVC re-exec requires execution with an absolute or relative path");
+          return(1);
+        }
+
         /*
          * There is no need to change LD_LIBRARY_PATH
          * if we were not able to find a path to libjvm.so
-- 
1.7.3.5