Skip to content

Commit 36a49d5

Browse files
added utf8 validation for title formatting output
1 parent 881c98d commit 36a49d5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mprisServer.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,13 @@ GVariant* getMetadataForTrack(int track_id, struct MprisData *mprisData) {
295295
continue;
296296
}
297297

298+
size_t len = strlen(buf);
299+
const char *end = NULL;
300+
if (!(g_utf8_validate (buf, -1, &end) && (end == buf + len))) {
301+
debug("meta string for '%s' failed utf8 validation: %s\n", record->fieldName, buf);
302+
continue;
303+
}
304+
298305
debug("got string '%s' for field %s\n", buf, record->fieldName);
299306

300307
GVariant *variant = record->produceVariantCb(buf);

0 commit comments

Comments
 (0)