diff pidgin/gtksourceundomanager.c @ 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 a92cadf6a978
children 44b4e8bd759b
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