Skip to content

Commit

Permalink
added utf8 validation for title formatting output
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Mar 2, 2023
1 parent 881c98d commit 36a49d5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mprisServer.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ GVariant* getMetadataForTrack(int track_id, struct MprisData *mprisData) {
continue;
}

size_t len = strlen(buf);
const char *end = NULL;
if (!(g_utf8_validate (buf, -1, &end) && (end == buf + len))) {
debug("meta string for '%s' failed utf8 validation: %s\n", record->fieldName, buf);
continue;
}

debug("got string '%s' for field %s\n", buf, record->fieldName);

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

0 comments on commit 36a49d5

Please sign in to comment.