On 8/12/21 3:18 PM, Hugh McMaster wrote:
if (!(screen_buffer->font.face_name = malloc( screen_buffer->font.face_len ))) return NULL;
memcpy( screen_buffer->font.face_name, console->active->font.face_name,
screen_buffer->font.face_len );
if (screen_buffer->font.face_len)
{
screen_buffer->font.face_name = malloc((screen_buffer->font.face_len + 1) * sizeof(WCHAR));
if (!screen_buffer->font.face_name) return NULL;
lstrcpyW(screen_buffer->font.face_name, console->active->font.face_name);
This does not only change the meaning of length, but also null-terminates the string. Is there any reason for that? It doesn't make much sense to both store the length and null-terminate string at the same time.
Thanks,
Jacek