summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nautilus-view-dnd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nautilus-view-dnd.c b/src/nautilus-view-dnd.c
index c50c465d3..5459f970d 100644
--- a/src/nautilus-view-dnd.c
+++ b/src/nautilus-view-dnd.c
@@ -354,9 +354,9 @@ get_drop_filename (const char *text)
PangoLogAttr *attrs;
gchar *current_char;
- num_attrs = MIN (g_utf8_strlen (text, -1) + 1, MAX_LEN_FILENAME);
+ num_attrs = MIN (g_utf8_strlen (text, -1), MAX_LEN_FILENAME) + 1;
attrs = g_new (PangoLogAttr, num_attrs);
- g_utf8_strncpy (trimmed, text, num_attrs);
+ g_utf8_strncpy (trimmed, text, num_attrs - 1);
pango_get_log_attrs (trimmed, -1, -1, pango_language_get_default (), attrs, num_attrs);
/* since the end of the text will always match a word boundary don't include it */