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
@ -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…
x
Reference in New Issue
Block a user