The buffer needs to hold atleast 8 - 7 chars plus a null terminator, the '\0' char or 0.