changeset 7399:cac9fc67df3e

8036571: (process) Process process arguments carefully Reviewed-by: rriggs, coffeys
author robm
date Thu, 27 Mar 2014 17:28:32 +0000
parents bfbb7e4e19d6
children 1c76e1c3182f
files src/share/classes/java/lang/ProcessBuilder.java
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/ProcessBuilder.java	Tue Mar 25 11:19:04 2014 -0700
+++ b/src/share/classes/java/lang/ProcessBuilder.java	Thu Mar 27 17:28:32 2014 +0000
@@ -1018,6 +1018,12 @@
 
         String dir = directory == null ? null : directory.toString();
 
+        for (int i = 1; i < cmdarray.length; i++) {
+            if (cmdarray[i].indexOf('\u0000') >= 0) {
+                throw new IOException("invalid null character in command");
+            }
+        }
+
         try {
             return ProcessImpl.start(cmdarray,
                                      environment,