Address Coverity Scan errors

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
master
Claudio Matsuoka 11 years ago
parent 440c071c78
commit 35dcef4fd6
  1. 1
      Changelog
  2. 1
      src/options.c
  3. 22
      src/read_config.c
  4. 2
      src/sound.h

@ -3,6 +3,7 @@ Stable versions
4.0.11 ():
- Mark surround channels in channel list
- Address errors reported by Coverity Scan
4.0.10 (20141030):
- Add AIFF file output driver (by Lorence Lombardo)

@ -327,6 +327,7 @@ void get_options(int argc, char **argv, struct options *options)
break;
case 'h':
usage(argv[0], options);
/* fall through */
default:
exit(-1);
}

@ -81,8 +81,9 @@ int read_config(struct options *o)
while (!feof(rc)) {
memset(line, 0, 256);
fscanf(rc, "%255[^\n]", line);
fgetc(rc);
if (fscanf(rc, "%255[^\n]", line) < 0 || fgetc(rc) < 0) {
break;
}
/* Delete comments */
if ((hash = strchr(line, '#')))
@ -90,8 +91,9 @@ int read_config(struct options *o)
delete_spaces(line);
if (!(var = strtok(line, "=\n")))
if (!(var = strtok(line, "=\n"))) {
continue;
}
val = strtok(NULL, " \t\n");
@ -146,7 +148,8 @@ int read_config(struct options *o)
}
if (!strcmp(var, "instrument_path")) {
strncpy(instrument_path, val, 256);
strncpy(instrument_path, val, 255);
instrument_path[255] = 0;
o->ins_path = instrument_path;
continue;
}
@ -194,8 +197,9 @@ static void parse_modconf(struct options *o, char *confname, unsigned char *md5)
while (!feof(rc)) {
memset(line, 0, 256);
fscanf(rc, "%255[^\n]", line);
fgetc(rc);
if (fscanf(rc, "%255[^\n]", line) < 0 || fgetc(rc) < 0) {
break;
}
/* Delete comments */
if ((hash = strchr(line, '#')))
@ -210,13 +214,15 @@ static void parse_modconf(struct options *o, char *confname, unsigned char *md5)
continue;
}
if (!active)
if (!active) {
continue;
}
delete_spaces(line);
if (!(var = strtok(line, "=\n")))
if (!(var = strtok(line, "=\n"))) {
continue;
}
val = strtok(NULL, " \t\n");

@ -20,7 +20,7 @@ struct sound_driver {
};
#define parm_init(p) { char *token; for (; *(p); (p)++) { \
char s[80]; strncpy(s, *(p), 80); \
char s[80]; strncpy(s, *(p), 79); s[79] = 0; \
token = strtok(s, ":="); token = strtok(NULL, "");
#define parm_end() } }
#define parm_error() do { \

Loading…
Cancel
Save