Validate if input is utf-8 for dmenu, if not ignore that line

This should avoid crashing on invalid encoding.
This commit is contained in:
Dave Davenport 2016-02-09 19:54:43 +01:00
parent 2cc2522e57
commit 5185f1181c

View file

@ -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;