diff options
-rw-r--r-- | libbb/sysconf.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libbb/sysconf.c b/libbb/sysconf.c index cfad9cd..8c1caef 100644 --- 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 |