summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--playtreeparser.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/playtreeparser.c b/playtreeparser.c
index 5343539108..777af83634 100644
--- a/playtreeparser.c
+++ b/playtreeparser.c
@@ -334,8 +334,14 @@ parse_pls(play_tree_parser_t* p) {
num = pls_read_entry(line+6,&entries,&max_entry,&v);
if(num < 0)
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
- else
- entries[num-1].length = strdup(v);
+ else {
+ char *end;
+ long val = strtol(v, &end, 10);
+ if (*end || (val <= 0 && val != -1))
+ mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Invalid length value in entry %s\n",line);
+ else if (val > 0)
+ entries[num-1].length = strdup(v);
+ }
} else
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Unknown entry type %s\n",line);
line = play_tree_parser_get_line(p);
@@ -348,6 +354,8 @@ parse_pls(play_tree_parser_t* p) {
mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",entries[num].file);
entry = play_tree_new();
play_tree_add_file(entry,entries[num].file);
+ if (entries[num].length)
+ play_tree_set_param(entry, "endpos", entries[num].length);
free(entries[num].file);
if(list)
play_tree_append_entry(last_entry,entry);