Reject negative and out-of-range values in non-negative integer parsing

This commit is contained in:
Andrea Mazzoleni 2026-09-28 21:03:33 +02:00
parent 99a79b7049
commit 6f74455864
6 changed files with 131 additions and 23 deletions

View file

@ -1444,7 +1444,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
/* LCOV_EXCL_STOP */
}
int val = strtou(buffer, &e, 0);
int val = strton(buffer, &e, 0);
if (e && !*e) {
/* numerical form */
@ -1593,7 +1593,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
/* LCOV_EXCL_STOP */
}
state->autosave = strtoul(buffer, &e, 0);
state->autosave = strtonl(buffer, &e, 0);
if (!e || *e) {
/* LCOV_EXCL_START */