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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270113
@ -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 New Issue
Block a user