-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trim env var for startup check #395
Conversation
Signed-off-by: 1000TurquoisePogs <[email protected]>
Signed-off-by: 1000TurquoisePogs <[email protected]>
if (!strcmp(continueWithWarning, "true")) { | ||
/* using STDENV in JCL can result in env values that need trimming... */ | ||
char *trimmed[strlen(continueWithWarning)+1]; | ||
strncpy(trimmed, continueWithWarning, strlen(continueWithWarning)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will leave the destination unterminated because trimmed
isn't initialized to zeroes; trimRight
may 0C4.
@@ -121,7 +121,12 @@ void abortIfUnsupportedCAA() { | |||
#ifndef METTLE | |||
if (zosVersion > LE_MAX_SUPPORTED_ZOS) { | |||
const char *continueWithWarning = getenv("ZWE_zowe_launcher_unsafeDisableZosVersionCheck"); | |||
if (!strcmp(continueWithWarning, "true")) { | |||
/* using STDENV in JCL can result in env values that need trimming... */ | |||
char *trimmed[strlen(continueWithWarning)+1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoeNemo just pointed to a bug here. This shouldn't have *
.
@@ -121,7 +121,12 @@ void abortIfUnsupportedCAA() { | |||
#ifndef METTLE | |||
if (zosVersion > LE_MAX_SUPPORTED_ZOS) { | |||
const char *continueWithWarning = getenv("ZWE_zowe_launcher_unsafeDisableZosVersionCheck"); | |||
if (!strcmp(continueWithWarning, "true")) { | |||
/* using STDENV in JCL can result in env values that need trimming... */ | |||
char *trimmed[strlen(continueWithWarning)+1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just save the length once and reuse it?
size_t valueLen = strlen(continueWithWarning);
Like in the launcher, any code that's expected to be run with env vars set from JCL should also expect that env vars can come in with trailing spaces.
This is a little ugly but the version-checking code in this PR is expected to be entirely removed soon, so this is another stop-gap to get people able to use zowe on untested versions of zos.