Versions Compared

Key

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

The alloca function dynamically allocates memory on the stack. Unlike malloc, it does not return NULL if it is unable to allocate the memory. If it was unable to allocate the memory, attempting to use it will result in undefined behavior, most likely a crash.stack is often used for convenient temporary storage, since allocated memory will automatically be freed when the function returns. However, most methods of stack allocation have no way to report failure due to lack of memory or collision. Instead of returning an error code, a failure to grow the autostack results in the process being killed. If user input is able to influence the amount of stack memory allocated then an attacker could use this in a denial of service attack.

C99 includes support for variable length arrays.

Recursion