Update of /cvsroot/xine/xine-lib/src/input
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7196/src/input

Modified Files:
        input_dvb.c 
Log Message:
Prevent segfaults on out-of-range last_channel.

Index: input_dvb.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/input/input_dvb.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- input_dvb.c 13 Jul 2006 09:50:14 -0000      1.79
+++ input_dvb.c 8 Dec 2006 22:26:22 -0000       1.80
@@ -3183,15 +3183,14 @@
       }
 
     if (lastchannel_enable.num_value){
-      if (lastchannel.num_value>-1) /* plugin has been used before - channel 
is valid */
-       sprintf(foobuffer,"dvb://%s",channels[lastchannel.num_value].name);
-      else                         /* set a reasonable default - the first 
channel */
-       
sprintf(foobuffer,"dvb://%s",channels[lastchannel_enable.num_value].name);
-       if(class->autoplaylist[0])
-         free(class->autoplaylist[0]);
-       class->autoplaylist[0]=xine_xmalloc(128);
-       _x_assert(class->autoplaylist[0] != NULL);
-       class->autoplaylist[0]=strdup(foobuffer);
+      if (lastchannel.num_value > -1 && lastchannel.num_value < num_channels)
+       /* plugin has been used before - channel is valid */
+       sprintf (foobuffer, "dvb://%s", channels[lastchannel.num_value].name);
+      else
+       /* set a reasonable default - the first channel */
+       sprintf (foobuffer, "dvb://%s", num_channels ? channels[0].name : "0");
+      free(class->autoplaylist[0]);
+      class->autoplaylist[0]=strdup(foobuffer);
     }
 
     free(tmpbuffer);


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog

Reply via email to