Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added compliant solution

...

Code Block
bgColor#ccccff
langc
char local[10];
 
void squirrel_away(char **ptr_param) {
    /* Initialize array */
   *ptr_param = local;
}

void rodent() {
  char *ptr;
  squirrel_away(&ptr);
  /* ptr is live butand invalidvalid here */
}

Risk Assessment

Referencing an object outside of its lifetime can result in an attacker being able to run arbitrary code.

...