Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccFF
int foo()
{
    char *env;
    char *copy_of_env;

    env = getenv("TEST_ENV");
    copy_of_env = malloc( strlen(env) + 1 );
    /* Error handling */
    strcpy(copy_of_env, env);

    copy_of_env[0] = 'a';

    /*Do some more things*/

    return 0;
}

Risk Assessment

The system will not be able to properly keep track of the size of environment variables, leading to memory management exploits.

Rule

Severity 

Likelihood 

Remediation Cost

Priority

Level

ENV30-C

2 (medium)

3 (probable)

2 (medium)

P12

L1

...