Is this program susceptible to a buffer overflow exploit?
Your program parses the Content-Length header and stores its value in an int called length:

length = atoi (getenv ("CONTENT_LENGTH")))


Then it increments this value and uses it as the argument of a call to malloc():

result = malloc (length + 1))


Suppose I were to post 232&minus;1 bytes of data to your program (about 4 GB in other words). If it's running in a 32-bit environment, the value of length + 1 will overflow to zero. The subsequent call to malloc() will probably succeed, but the call to fread() will crash the program immediately.