Odds are that you didn't allocate space, or enough space, for headerSizeBuffer and it is getting overwritten some time between (the start of) the call to printf and (the end of) the call to strtol.
Edit: From the comment above: "char* headerSizeBuffer"
Yup, I was right. Since you haven't allocated any space you have undefined behavior ... which means that any behavior might occur, including what you're seeing. Be sure that you allocate enough space to headerSizeBuffer, either by setting it to point to enough memory (that could be from malloc, or it could be an array, or various other less common means) or, more appropriate to your case because the size needed is known at compile time, declaring it as an array rather than a pointer:
char headerSizeBuffer[4];
Be sure to set headerSizeBuffer[3] = '\0` to terminate the string before passing it to strtol.