rt: Don't overshoot the end of the logging spec during parsing
This commit is contained in:
parent
9e9d57657d
commit
0b73b29383
1 changed files with 7 additions and 4 deletions
|
@ -154,10 +154,12 @@ size_t parse_logging_spec(char* spec, log_directive* dirs) {
|
||||||
cur = *spec;
|
cur = *spec;
|
||||||
if (cur == ',' || cur == '=' || cur == '\0') {
|
if (cur == ',' || cur == '=' || cur == '\0') {
|
||||||
if (start == spec) {spec++; break;}
|
if (start == spec) {spec++; break;}
|
||||||
*spec = '\0';
|
if (*spec != '\0') {
|
||||||
spec++;
|
*spec = '\0';
|
||||||
|
spec++;
|
||||||
|
}
|
||||||
size_t level = max_log_level;
|
size_t level = max_log_level;
|
||||||
if (cur == '=') {
|
if (cur == '=' && *spec != '\0') {
|
||||||
level = *spec - '0';
|
level = *spec - '0';
|
||||||
if (level > max_log_level) level = max_log_level;
|
if (level > max_log_level) level = max_log_level;
|
||||||
if (*spec) ++spec;
|
if (*spec) ++spec;
|
||||||
|
@ -165,8 +167,9 @@ size_t parse_logging_spec(char* spec, log_directive* dirs) {
|
||||||
dirs[dir].name = start;
|
dirs[dir].name = start;
|
||||||
dirs[dir++].level = level;
|
dirs[dir++].level = level;
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
spec++;
|
||||||
}
|
}
|
||||||
spec++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dir;
|
return dir;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue