Update of /cvsroot/alsa/alsa-tools/envy24control
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2979
Modified Files:
envy24control.c profiles.c
Log Message:
<[EMAIL PROTECTED]>
fixed profile number range checks
Index: envy24control.c
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/envy24control/envy24control.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- envy24control.c 16 May 2004 13:42:31 -0000 1.28
+++ envy24control.c 18 May 2004 11:34:07 -0000 1.29
@@ -1908,7 +1908,7 @@
max_digits++;
if (strlen(default_profile) <= max_digits) {
profile_number = atoi(default_profile);
- if (profile_number > MAX_PROFILES)
+ if (profile_number < 1 || profile_number >
MAX_PROFILES)
profile_number =
get_profile_number(default_profile, card_number, profiles_file_name);
} else {
profile_number = get_profile_number(default_profile,
card_number, profiles_file_name);
Index: profiles.c
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/envy24control/profiles.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- profiles.c 16 May 2004 13:37:31 -0000 1.1
+++ profiles.c 18 May 2004 11:34:07 -0000 1.2
@@ -753,7 +753,7 @@
buffer_copy[max_length - 1] = '\0';
memset(buffer + pos_begin, '\0', max_length - pos_begin);
}
- if (profile_number >= 0) {
+ if (profile_number > 0) {
place_holder = PLACE_HOLDER_NUM;
snprintf(profile_number_or_card_number_as_str, MAX_NUM_STR_LENGTH,
"%d", profile_number);
profile_number_or_card_number_as_str[MAX_NUM_STR_LENGTH - 1] = '\0';
@@ -835,7 +835,7 @@
if (res > 0) {
if ((profile_begin = get_profile_begin(buffer, profile_number)) < 0) {
if (profile_number < MAX_PROFILES) {
- for (profile_nr = 0; profile_nr <= MAX_PROFILES;
profile_nr++)
+ for (profile_nr = 1; profile_nr <= MAX_PROFILES;
profile_nr++)
{
if (profile_nr > profile_number) {
if ((profile_begin =
get_profile_begin(buffer, profile_nr)) >= 0)
@@ -1052,8 +1052,8 @@
"by replacing
place holder '%c' with profile number.\n", \
PROFILE_HEADER_TEMPL, PLACE_HOLDER_NUM);
/* check profile number */
- } else if (profile_number > MAX_PROFILES) {
- fprintf(stderr, "profile number '%d'
is incorrect. the maximum profile number will be '%d'.\n", \
+ } else if (profile_number < 1 ||
profile_number > MAX_PROFILES) {
+ fprintf(stderr, "profile number '%d'
is incorrect. the profile number will be in [1 ... %d].\n", \
profile_number, MAX_PROFILES);
profile_number = -EINVAL;
}
@@ -1075,6 +1075,11 @@
int res, max_length;
void *buffer = NULL;
+ if (profile_number < 1 || profile_number > MAX_PROFILES) {
+ fprintf(stderr, "profile number '%d' is incorrect. the profile number
will be in [1 ... %d].\n", \
+ profile_number, MAX_PROFILES);
+ return NULL;
+ }
if (cfgfile == NULL)
cfgfile = DEFAULT_PROFILERC;
res = which_cfgfile(&cfgfile);
@@ -1115,6 +1120,11 @@
{
int res;
+ if (profile_number < 1 || profile_number > MAX_PROFILES) {
+ fprintf(stderr, "profile number '%d' is incorrect. the profile number
will be in [1 ... %d].\n", \
+ profile_number, MAX_PROFILES);
+ return -EINVAL;
+ }
if (cfgfile == NULL)
cfgfile = DEFAULT_PROFILERC;
if (!strcmp(operation, ALSACTL_OP_STORE)) {
-------------------------------------------------------
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