Skip to content

Commit

Permalink
examples: Make playlist parsing a little more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
ford-prefect committed Oct 30, 2017
1 parent 303eaa2 commit 049568c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/test-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ read_playlist_file (const gchar * path)
}

for (i = 0, read = 0; read <length; i++) {
sscanf (&contents[read], "%s %lu\n%n", uri, &durations[i], &len);
if (sscanf (&contents[read], "%s %lu\n%n", uri, &durations[i], &len) != 2) {
g_message ("Error parsing URI at line: %s", &contents[read]);
goto done;
}

uris[i] = g_strdup (uri);

read += len;
Expand Down

0 comments on commit 049568c

Please sign in to comment.