changeset 19548:e2135da444a5

"text" isn't guarranteed to be null terminated, so make sure we use the given "length" parameter. Fixes #2224.
author Mark Doliner <mark@kingant.net>
date Thu, 30 Aug 2007 07:03:12 +0000
parents 6c726af063c9
children 5f4100c7dd00
files pidgin/gtksourceundomanager.c
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtksourceundomanager.c	Thu Aug 30 06:45:27 2007 +0000
+++ b/pidgin/gtksourceundomanager.c	Thu Aug 30 07:03:12 2007 +0000
@@ -677,8 +677,6 @@
 	if (um->priv->running_not_undoable_actions > 0)
 		return;
 
-	g_return_if_fail (strlen (text) >= (guint)length);
-	
 	undo_action.action_type = GTK_SOURCE_UNDO_ACTION_INSERT;
 
 	undo_action.action.insert.pos    = gtk_text_iter_get_offset (pos);
@@ -774,7 +772,7 @@
 		*action = *undo_action;
 
 		if (action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT)
-			action->action.insert.text = g_strdup (undo_action->action.insert.text);
+			action->action.insert.text = g_strndup (undo_action->action.insert.text, undo_action->action.insert.length);
 		else if (action->action_type == GTK_SOURCE_UNDO_ACTION_DELETE)
 			action->action.delete.text = g_strdup (undo_action->action.delete.text); 
 		else