src/desktop-trampoline.c
/** Returns 1 if a given env variable is valid, 0 otherwise. */
Returns 1 if a given env variable is valid, 0 otherwise.
Returns 1 if a given env variable is valid 0 otherwise .
int isValidEnvVar(char *env) {
  for (int idx = 0; idx < NUMBER_OF_VALID_ENV_VARS; idx++) {
    const char *candidate = sValidEnvVars[idx];
    if (strncmp(env, candidate, strlen(candidate)) == 0
        && strlen(env) > strlen(candidate)
        && env[strlen(candidate)] == '=') {
      return 1;
    }
  }
  return 0;
}
int isValidEnvVar ( char * env ) { for ( int idx = 0 ; idx < NUMBER_OF_VALID_ENV_VARS ; idx ++ ) { const char * candidate = sValidEnvVars [ idx ] ; if ( strncmp ( env , candidate , strlen ( candidate ) ) == 0 && strlen ( env ) > strlen ( candidate ) && env [ strlen ( candidate ) ] == ' ' ) { return 1 ; } } return 0 ; }
Returns 1 if a given env variable is valid, 0 otherwise.
Returns 1 if a given env variable is valid 0 otherwise .
// Make sure that not only the passed env var string starts with the // candidate contesnts, but also that there is a '=' character right after: // Valid: "DESKTOP_USERNAME=sergiou87" // Not valid: "DESKTOP_USERNAME_SOMETHING=sergiou87"