diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2013-08-16 18:30:57 +0200 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2013-08-16 18:38:26 +0200 |
commit | 16ea52970d059a1c03dc1ce27dc78f067421dc92 (patch) | |
tree | 2a1772c4cca791e6980036c9cda0c63f375ad723 /src/nautilus-view-dnd.c | |
parent | 621f96a941453ec09b75fcad3873c5719d2819d6 (diff) | |
download | nautilus-16ea52970d059a1c03dc1ce27dc78f067421dc92.tar.gz |
view-dnd: pass the correct attrs number to pango_get_log_attrs()
num_attrs always needs to be the number of characters plus one, or Pango
will warn and possibly corrupt memory.
https://bugzilla.gnome.org/show_bug.cgi?id=706131
Diffstat (limited to 'src/nautilus-view-dnd.c')
-rw-r--r-- | src/nautilus-view-dnd.c | 4 |
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 */ |