mirror of
https://github.com/mpv-player/mpv
synced 2025-05-26 16:52:26 +02:00
bugfix
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1091 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d4239d7b1e
commit
d646cfabf3
20
cfgparser.c
20
cfgparser.c
@ -241,6 +241,7 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
int opt_pos; /* opt pos */
|
int opt_pos; /* opt pos */
|
||||||
int param_pos; /* param pos */
|
int param_pos; /* param pos */
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
int errors = 0;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(conffile != NULL);
|
assert(conffile != NULL);
|
||||||
@ -276,6 +277,12 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
while (fgets(line, MAX_LINE_LEN, fp)) {
|
while (fgets(line, MAX_LINE_LEN, fp)) {
|
||||||
|
nextline:
|
||||||
|
if (errors >= 16) {
|
||||||
|
printf("too many errors\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
line_num++;
|
line_num++;
|
||||||
line_pos = 0;
|
line_pos = 0;
|
||||||
|
|
||||||
@ -296,14 +303,16 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
if (opt_pos >= MAX_OPT_LEN) {
|
if (opt_pos >= MAX_OPT_LEN) {
|
||||||
PRINT_LINENUM;
|
PRINT_LINENUM;
|
||||||
printf("too long option\n");
|
printf("too long option\n");
|
||||||
|
errors++;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
continue;
|
goto nextline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt_pos == 0) {
|
if (opt_pos == 0) {
|
||||||
PRINT_LINENUM;
|
PRINT_LINENUM;
|
||||||
printf("parse error\n");
|
printf("parse error\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
opt[opt_pos] = '\0';
|
opt[opt_pos] = '\0';
|
||||||
@ -321,6 +330,7 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
PRINT_LINENUM;
|
PRINT_LINENUM;
|
||||||
printf("option without parameter\n");
|
printf("option without parameter\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +348,8 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
PRINT_LINENUM;
|
PRINT_LINENUM;
|
||||||
printf("too long parameter\n");
|
printf("too long parameter\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
continue;
|
errors++;
|
||||||
|
goto nextline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
line_pos++; /* skip the closing " or ' */
|
line_pos++; /* skip the closing " or ' */
|
||||||
@ -350,7 +361,8 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
PRINT_LINENUM;
|
PRINT_LINENUM;
|
||||||
printf("too long parameter\n");
|
printf("too long parameter\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
continue;
|
errors++;
|
||||||
|
goto nextline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,6 +373,7 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
PRINT_LINENUM;
|
PRINT_LINENUM;
|
||||||
printf("option without parameter\n");
|
printf("option without parameter\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -388,6 +401,7 @@ int parse_config_file(struct config *conf, char *conffile)
|
|||||||
PRINT_LINENUM;
|
PRINT_LINENUM;
|
||||||
printf("%s\n", opt);
|
printf("%s\n", opt);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
/* break */
|
/* break */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user