summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-02-09 19:54:43 +0100
committerDave Davenport <qball@gmpclient.org>2016-02-09 19:54:43 +0100
commit5185f1181c9ec9d98a0edf85cb9ad5d08948ef06 (patch)
treef96a88e59f3836921e1eec3f61ee3176da50facf /source
parent2cc2522e57510cfe9e73f9b8b64af9bd6cd18591 (diff)
Validate if input is utf-8 for dmenu, if not ignore that line
This should avoid crashing on invalid encoding.
Diffstat (limited to 'source')
-rw-r--r--source/dialogs/dmenu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index 523ba0cb..f336a1fd 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -87,6 +87,11 @@ static char **get_dmenu ( FILE *fd, unsigned int *length )
}
if ( data[l - 1] == config.separator ) {
data[l - 1] = '\0';
+ l--;
+ }
+ if ( ! g_utf8_validate ( data, l, NULL) ) {
+ fprintf(stderr, "String: '%s' is not valid utf-8\n", data);
+ continue;
}
retv[( *length )] = data;