fix buffer overflow in case of length of str equal to 255

No match.