mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
sh: Avoid overflow in atoi() when parsing HISTSIZE.
Side effect: a non-numeric HISTSIZE now results in the default size (100) instead of 0.
This commit is contained in:
parent
06224a9492
commit
ef9e61785a
1 changed files with 3 additions and 2 deletions
|
|
@ -166,9 +166,10 @@ sethistsize(const char *hs)
|
|||
HistEvent he;
|
||||
|
||||
if (hist != NULL) {
|
||||
if (hs == NULL || *hs == '\0' ||
|
||||
(histsize = atoi(hs)) < 0)
|
||||
if (hs == NULL || !is_number(hs))
|
||||
histsize = 100;
|
||||
else
|
||||
histsize = atoi(hs);
|
||||
history(hist, &he, H_SETSIZE, histsize);
|
||||
history(hist, &he, H_SETUNIQUE, 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue