Matching empty string makes rm_so and rm_eo of struct regmatch_t have
the same value, in this case both of them are 11. This causes a call to
atoi("\0") whose return value 0 is just the initial value of 'debug'.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
line[r] = '\0';
close(fd);
- regcomp(&pat_cmdline, "init_debug=([0-9]*)", REG_EXTENDED);
+ regcomp(&pat_cmdline, "init_debug=([0-9]+)", REG_EXTENDED);
if (!regexec(&pat_cmdline, line, 2, matches, 0)) {
line[matches[1].rm_eo] = '\0';
debug = atoi(&line[matches[1].rm_so]);