Skip to content

Commit

Permalink
Guard against invalid UTF-8 being passed to tuple_set_str().
Browse files Browse the repository at this point in the history
  • Loading branch information
jlindgren90 committed Feb 1, 2012
1 parent 84483a2 commit c36b8fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libaudcore/tuple.c
Expand Up @@ -400,6 +400,12 @@ void tuple_set_str (Tuple * tuple, int nfield, const char * field, const char *
return;
}

if (! g_utf8_validate (str, -1, NULL))
{
fprintf (stderr, "Invalid UTF-8: %s\n", str);
return;
}

if (nfield < 0)
nfield = tuple_field_by_name (field);
if (nfield < 0 || nfield >= TUPLE_FIELDS || tuple_fields[nfield].type != TUPLE_STRING)
Expand Down

0 comments on commit c36b8fb

Please sign in to comment.