Fix possible overflow

gtk_entry_get_text_length() returns len in utf8
chars not in bytes
This commit is contained in:
TingPing 2015-06-04 04:02:33 -04:00
parent 94ef0fd294
commit afd2135393

View File

@ -1169,8 +1169,8 @@ setup_entry_cb (GtkEntry *entry, setting *set)
{ {
int size; int size;
int pos; int pos;
int len = gtk_entry_get_text_length (entry);
unsigned char *p = (unsigned char*)gtk_entry_get_text (entry); unsigned char *p = (unsigned char*)gtk_entry_get_text (entry);
int len = strlen (p);
/* need to truncate? */ /* need to truncate? */
if (len >= set->extra) if (len >= set->extra)