The product calls free() on a pointer to a memory resource that was allocated on the heap, but the pointer is not at the start of the buffer.
This can cause the product to crash, or in some cases, modify critical program variables or execute code. This weakness often occurs when the memory is allocated explicitly on the heap with one of the malloc() family functions and free() is called, but pointer arithmetic has caused the pointer to be in the interior or end of the buffer.
Impact: Modify MemoryDoS: Crash, Exit, or RestartExecute Unauthorized Code or Commands
Strategy: Libraries or Frameworks
c
/* matched char, free string and return success / free(str); return SUCCESS;}
cc
/* matched char, free string and return success / free(str); return SUCCESS;}
cc//hardcode input length for simplicity* char* input = (char*) malloc(40*sizeof(char)); char tok; char sep = " \t";
c
c//hardcode input length for simplicity* char* input = (char*) malloc(40*sizeof(char)); char *tok, command; char sep = " \t";
c
c