projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
11775ed
)
libbb: add sanity check in bb_arg_max()
author
Denys Vlasenko
<vda.linux@googlemail.com>
Wed, 24 Dec 2014 00:46:29 +0000
(
01:46
+0100)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Wed, 24 Dec 2014 00:46:29 +0000
(
01:46
+0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/sysconf.c
patch
|
blob
|
history
diff --git
a/libbb/sysconf.c
b/libbb/sysconf.c
index cfad9cdc08a0aaa4ede4ec6a8b0ad8bab144abe5..8c1caef5cd73e7d367d1af261a6137b98d59b4e7 100644
(file)
--- a/
libbb/sysconf.c
+++ b/
libbb/sysconf.c
@@
-11,7
+11,15
@@
#if !defined(bb_arg_max)
unsigned FAST_FUNC bb_arg_max(void)
{
- return sysconf(_SC_ARG_MAX);
+ long r = sysconf(_SC_ARG_MAX);
+
+ /* I've seen a version of uclibc which returned -1.
+ * Guard about it, and also avoid insanely large values
+ */
+ if ((unsigned long)r > 64*1024*1024)
+ r = 64*1024*1024;
+
+ return r;
}
#endif