commit 895a8ec484ead49ab243772895b24b787e94ef0e
parent 2c291aed4bb80f07e8557284d3399cf1e2a4ccb9
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sun, 1 Mar 2026 18:19:04 +0100
Improve solver name check
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git 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])
{
char format_error_msg[100];
sprintf(format_error_msg, "[H48] Error parsing H48 solver: must be in "
- "'h48h*' format, but got '%s'\n", buf);
+ "'h48hNN' format, but got '%s'\n", buf);
buf += 3;
@@ -22,6 +22,13 @@ parse_h48h(const char *buf, uint8_t h[static 1])
}
buf++;
+ if (strlen(buf) > 2 ||
+ (strlen(buf) >= 1 && *buf < '1' && *buf > '9') ||
+ (strlen(buf) == 2 && *buf < '0' && *buf > '9')) {
+ LOG(format_error_msg);
+ goto parse_h48h_error;
+ }
+
*h = atoi(buf);
if (*h > H48_HMAX) {
LOG("[H48] Invalid value %" PRIu8 " for parameter h (must be "