changeset 25141:fba022abe464

100l in play_tree_parser_get_line, check that there actually is a previous character before comparing it against '\r'. Fixes a possible crash on playlist file that is empty or starts with an empty line.
author reimar
date Mon, 26 Nov 2007 20:35:27 +0000
parents 6b1f99f9b2f6
children 8f536e45b998
files playtreeparser.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/playtreeparser.c	Mon Nov 26 19:04:31 2007 +0000
+++ b/playtreeparser.c	Mon Nov 26 20:35:27 2007 +0000
@@ -93,7 +93,7 @@
     break;
   }
 
-  line_end = ((*(end-1)) == '\r') ? end-1 : end;
+  line_end = (end > p->iter && *(end-1) == '\r') ? end-1 : end;
   if(line_end - p->iter >= 0)
     p->line = (char*)realloc(p->line,line_end - p->iter+1);
   else