svn commit: r270113 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Sun Aug 17 19:36:57 UTC 2014
Author: jilles
Date: Sun Aug 17 19:36:56 2014
New Revision: 270113
URL: http://svnweb.freebsd.org/changeset/base/270113
Log:
sh: Avoid overflow in atoi() when parsing HISTSIZE.
Side effect: a non-numeric HISTSIZE now results in the default size (100)
instead of 0.
Modified:
head/bin/sh/histedit.c
Modified: head/bin/sh/histedit.c
==============================================================================
--- head/bin/sh/histedit.c Sun Aug 17 19:24:26 2014 (r270112)
+++ head/bin/sh/histedit.c Sun Aug 17 19:36:56 2014 (r270113)
@@ -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);
}
More information about the svn-src-all
mailing list