mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-30 20:06:56 -05:00
Reject negative and out-of-range values in non-negative integer parsing
This commit is contained in:
parent
99a79b7049
commit
6f74455864
6 changed files with 131 additions and 23 deletions
|
|
@ -2356,21 +2356,21 @@ int smartctl_attribute(OS_FILE* f, const char* file, const char* name, struct sm
|
|||
|
||||
smart[id].raw = raw;
|
||||
|
||||
v = strtoul(norm, &e, 10);
|
||||
v = strtonl(norm, &e, 10);
|
||||
if (e != norm || *e == 0) {
|
||||
smart[id].norm = v;
|
||||
} else {
|
||||
smart[id].norm = SMART_UNASSIGNED;
|
||||
}
|
||||
|
||||
v = strtoul(worst, &e, 10);
|
||||
v = strtonl(worst, &e, 10);
|
||||
if (e != worst || *e == 0) {
|
||||
smart[id].worst = v;
|
||||
} else {
|
||||
smart[id].worst = SMART_UNASSIGNED;
|
||||
}
|
||||
|
||||
v = strtoul(thresh, &e, 10);
|
||||
v = strtonl(thresh, &e, 10);
|
||||
if (e != thresh || *e == 0) {
|
||||
smart[id].thresh = v;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue