commit ff4bc826cea62613a8a8966e40c40c37d569282f
parent 536650a24c5d17b948826de8eb1ee53cdb69b085
Author: Ben Webb <ben@salilab.org>
Date: Mon, 19 Aug 2002 12:48:33 +0000
Off-by-one bug fixed in gtk_editable_get_chars()
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c
@@ -1950,8 +1950,8 @@ gchar *gtk_editable_get_chars(GtkEditable *editable,
gtk_editable_sync_text(editable);
if (end_pos < 0 || end_pos >= editable->text->len)
end_pos = editable->text->len;
- copylen = end_pos - start_pos + 1;
- retbuf = g_new(gchar, copylen);
+ copylen = end_pos - start_pos;
+ retbuf = g_new(gchar, copylen + 1);
memcpy(retbuf, &editable->text->str[start_pos], copylen);
retbuf[copylen] = '\0';