This fixes issue with overflow when adding terminating null byte properly, without increasing buffer size.