View Single Post
Old 09-23-2014, 12:27 AM   #18
antto
Human being with feelings
 
Join Date: Nov 2008
Posts: 108
Default

because C-strings.. you should read up on them, but basically, any function that deals with c-strings where you don't specify the string length - it reads till it finds a null-char
so even if you do char blah[5]; then fill the first 4 bytes - the last byte hasn't been initialized, so its value can be zero.. but it can be anything else too

so, at least set the last byte to zero
antto is offline   Reply With Quote