Prevent undefined behaviour on memcpy

This commit is contained in:
Francisco Couzo 2018-01-17 21:59:03 -03:00 committed by TingPing
parent 7d7be83216
commit ee8926503c

View File

@ -4677,8 +4677,10 @@ gtk_xtext_append_indent (xtext_buffer *buf,
ent = g_malloc (left_len + right_len + 2 + sizeof (textentry));
str = (unsigned char *) ent + sizeof (textentry);
if (left_len)
memcpy (str, left_text, left_len);
str[left_len] = ' ';
if (right_len)
memcpy (str + left_len + 1, right_text, right_len);
str[left_len + 1 + right_len] = 0;