aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2016-07-04 09:56:36 +0000
committerGravatar Klaus Aehlig <aehlig@google.com>2016-07-04 11:34:04 +0000
commit0bfd767502c05c0296fd32130d64cfb38532fc1b (patch)
tree1a54eddde0a775606cd1c5512442f2f9aa94269e /src
parentd62cb1d9fecc50e405b69c93f258f5c5548f952f (diff)
Make the environment sanity check in nativeCreateProcess() consistent with what CreateProcess() does.
Test cases don't need to be changed because this issue was caught by CreateProcess() instead. -- MOS_MIGRATED_REVID=126560893
Diffstat (limited to 'src')
-rw-r--r--src/main/native/windows_processes.cc9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/main/native/windows_processes.cc b/src/main/native/windows_processes.cc
index a2c738f7c1..feb1c017e6 100644
--- a/src/main/native/windows_processes.cc
+++ b/src/main/native/windows_processes.cc
@@ -123,14 +123,9 @@ Java_com_google_devtools_build_lib_windows_WindowsProcesses_nativeCreateProcess(
env_size = env->GetArrayLength(java_env);
env_bytes = env->GetByteArrayElements(java_env, NULL);
- if (env_size < 1) {
- result->error_ = "The environment cannot be empty";
+ if (env_size < 2) {
+ result->error_ = "The environment must be at least two bytes long";
goto cleanup;
- } else if (env_size == 1) {
- if (env_bytes[0] != 0) {
- result->error_ = "Empty environment must contain a single zero byte";
- goto cleanup;
- }
} else if (env_bytes[env_size - 1] != 0 || env_bytes[env_size - 2] != 0) {
result->error_ = "Environment array must end with two null bytes";
goto cleanup;