3 ms·
Yes it was. Good catch. The size of the buffer is 4, so the last byte would be located at 4-1 = index 3. Because we're 0 based...Wow can't believe I did that. i
by _RPM 11y ago
Yes it was. Good catch. The size of the buffer is 4, so the last byte would be located at 4-1 = index 3. Because we're 0 based...Wow can't believe I did that. it's 12:30 AM here and I've had a few beers tonight.
It's common to allocate your size needed plus 1 for the NULL byte. But this programmer only allocates 4 bytes.. with no thought of the NULL byte at the end.