Update of /cvsroot/alsa/alsa-tools/envy24control
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31322

Modified Files:
        envy24control.c 
Log Message:
<[EMAIL PROTECTED]>
Next fix for -D option.


Index: envy24control.c
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/envy24control/envy24control.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- envy24control.c     16 May 2004 13:41:14 -0000      1.27
+++ envy24control.c     16 May 2004 13:42:31 -0000      1.28
@@ -1696,8 +1696,8 @@
                return EXIT_SUCCESS;
 
        card_nr = GTK_ADJUSTMENT (card_number_adj)->value;
-       if ((card_nr < 0) || (card_nr > MAX_CARD_NUMBERS)) {
-               fprintf(stderr, "card number not in [0 ... %d]\n", MAX_CARD_NUMBERS);
+       if ((card_nr < 0) || (card_nr >= MAX_CARD_NUMBERS)) {
+               fprintf(stderr, "card number not in [0 ... %d]\n", MAX_CARD_NUMBERS - 
1);
                gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON (delete_button), FALSE);
                return -EINVAL;
        }
@@ -1871,7 +1871,7 @@
        gtk_box_pack_start(GTK_BOX (hbox2), label_card_nr, FALSE, FALSE, 20);
        gtk_label_set_justify(GTK_LABEL (label_card_nr), GTK_JUSTIFY_LEFT);
 
-       card_button_adj = gtk_adjustment_new(16, 0, MAX_CARD_NUMBERS, 1, 10, 10);
+       card_button_adj = gtk_adjustment_new(16, 0, MAX_CARD_NUMBERS - 1, 1, 10, 10);
        card_number_adj = card_button_adj;
        card_button = gtk_spin_button_new(GTK_ADJUSTMENT (card_button_adj), 1, 0);
        gtk_widget_show(card_button);
@@ -1991,6 +1991,10 @@
                case 'D':
                        name = optarg;
                        card_number = atoi(strchr(name, ':') + sizeof(char));
+                       if (card_number < 0 || card_number >= MAX_CARD_NUMBERS) {
+                               fprintf(stderr, "envy24control: invalid card number 
%d\n", card_number);
+                               exit(1);
+                       }
                        break;
                case 'i':
                        input_channels = atoi(optarg);



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to