Author: mturk Date: Thu Mar 7 06:14:09 2013 New Revision: 1453695 URL: http://svn.apache.org/r1453695 Log: Ensure that execv uses absolute or relative path
Modified: commons/proper/daemon/branches/1.0.x/src/native/unix/native/jsvc-unix.c Modified: commons/proper/daemon/branches/1.0.x/src/native/unix/native/jsvc-unix.c URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/unix/native/jsvc-unix.c?rev=1453695&r1=1453694&r2=1453695&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/unix/native/jsvc-unix.c (original) +++ commons/proper/daemon/branches/1.0.x/src/native/unix/native/jsvc-unix.c Thu Mar 7 06:14:09 2013 @@ -1159,6 +1159,16 @@ 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. + */ + tmp = strchr(oldpath,'/'); + if (tmp == 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