diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-01 18:19:04 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-01 18:19:04 +0100 |
| commit | 895a8ec484ead49ab243772895b24b787e94ef0e (patch) | |
| tree | 1302cc572307cc1dc23655999c689069c3b76bfc /src/solvers | |
| parent | 2c291aed4bb80f07e8557284d3399cf1e2a4ccb9 (diff) | |
| download | nissy-core-895a8ec484ead49ab243772895b24b787e94ef0e.tar.gz nissy-core-895a8ec484ead49ab243772895b24b787e94ef0e.zip | |
Improve solver name check
Diffstat (limited to 'src/solvers')
| -rw-r--r-- | src/solvers/h48/utils.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/solvers/h48/utils.h b/src/solvers/h48/utils.h index 682eb1d..27fb2e5 100644 --- a/src/solvers/h48/utils.h +++ b/src/solvers/h48/utils.h | |||
| @@ -12,7 +12,7 @@ parse_h48h(const char *buf, uint8_t h[static 1]) | |||
| 12 | { | 12 | { |
| 13 | char format_error_msg[100]; | 13 | char format_error_msg[100]; |
| 14 | sprintf(format_error_msg, "[H48] Error parsing H48 solver: must be in " | 14 | sprintf(format_error_msg, "[H48] Error parsing H48 solver: must be in " |
| 15 | "'h48h*' format, but got '%s'\n", buf); | 15 | "'h48hNN' format, but got '%s'\n", buf); |
| 16 | 16 | ||
| 17 | buf += 3; | 17 | buf += 3; |
| 18 | 18 | ||
| @@ -22,6 +22,13 @@ parse_h48h(const char *buf, uint8_t h[static 1]) | |||
| 22 | } | 22 | } |
| 23 | buf++; | 23 | buf++; |
| 24 | 24 | ||
| 25 | if (strlen(buf) > 2 || | ||
| 26 | (strlen(buf) >= 1 && *buf < '1' && *buf > '9') || | ||
| 27 | (strlen(buf) == 2 && *buf < '0' && *buf > '9')) { | ||
| 28 | LOG(format_error_msg); | ||
| 29 | goto parse_h48h_error; | ||
| 30 | } | ||
| 31 | |||
| 25 | *h = atoi(buf); | 32 | *h = atoi(buf); |
| 26 | if (*h > H48_HMAX) { | 33 | if (*h > H48_HMAX) { |
| 27 | LOG("[H48] Invalid value %" PRIu8 " for parameter h (must be " | 34 | LOG("[H48] Invalid value %" PRIu8 " for parameter h (must be " |
