|
|
|
|
@ -65,64 +65,3 @@
|
|
|
|
|
|
|
|
|
|
#include "system.h"
|
|
|
|
|
|
|
|
|
|
http://www.guninski.com/binls.html
|
|
|
|
|
Workaround to defeat resource starvation using "ls -W hugenumber"
|
|
|
|
|
taken from Conectiva Updates <secure@conectiva.com.br>, CLA-2003:768
|
|
|
|
|
Index: src/ls.c
|
|
|
|
|
--- src/ls.c.orig 2003-07-27 08:33:36.000000000 +0200
|
|
|
|
|
+++ src/ls.c 2003-10-23 13:45:46.000000000 +0200
|
|
|
|
|
@@ -180,6 +180,8 @@
|
|
|
|
|
#define ID_LENGTH_MAX \
|
|
|
|
|
MAX (LOGIN_NAME_MAX - 1, LONGEST_HUMAN_READABLE)
|
|
|
|
|
|
|
|
|
|
+#define COLUMNS_MAX 1024
|
|
|
|
|
+
|
|
|
|
|
enum filetype
|
|
|
|
|
{
|
|
|
|
|
unknown DT_INIT (DT_UNKNOWN),
|
|
|
|
|
@@ -1316,7 +1318,7 @@
|
|
|
|
|
{
|
|
|
|
|
long int tmp_long;
|
|
|
|
|
if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK
|
|
|
|
|
- && 0 < tmp_long && tmp_long <= INT_MAX)
|
|
|
|
|
+ && 0 < tmp_long && tmp_long <= COLUMNS_MAX)
|
|
|
|
|
{
|
|
|
|
|
line_length = (int) tmp_long;
|
|
|
|
|
}
|
|
|
|
|
@@ -1334,7 +1336,7 @@
|
|
|
|
|
struct winsize ws;
|
|
|
|
|
|
|
|
|
|
if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col != 0)
|
|
|
|
|
- line_length = ws.ws_col;
|
|
|
|
|
+ line_length = MIN(ws.ws_col, COLUMNS_MAX);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
@@ -1347,7 +1349,7 @@
|
|
|
|
|
{
|
|
|
|
|
long int tmp_long;
|
|
|
|
|
if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK
|
|
|
|
|
- && 0 <= tmp_long && tmp_long <= INT_MAX)
|
|
|
|
|
+ && 0 <= tmp_long && tmp_long <= COLUMNS_MAX)
|
|
|
|
|
{
|
|
|
|
|
tabsize = (int) tmp_long;
|
|
|
|
|
}
|
|
|
|
|
@@ -1470,7 +1472,7 @@
|
|
|
|
|
{
|
|
|
|
|
long int tmp_long;
|
|
|
|
|
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
|
|
|
|
- || tmp_long <= 0 || tmp_long > INT_MAX)
|
|
|
|
|
+ || tmp_long <= 0 || tmp_long > COLUMNS_MAX)
|
|
|
|
|
error (EXIT_FAILURE, 0, _("invalid line width: %s"),
|
|
|
|
|
quotearg (optarg));
|
|
|
|
|
line_length = (int) tmp_long;
|
|
|
|
|
@@ -1544,7 +1546,7 @@
|
|
|
|
|
{
|
|
|
|
|
long int tmp_long;
|
|
|
|
|
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
|
|
|
|
- || tmp_long < 0 || tmp_long > INT_MAX)
|
|
|
|
|
+ || tmp_long < 0 || tmp_long > COLUMNS_MAX)
|
|
|
|
|
error (EXIT_FAILURE, 0, _("invalid tab size: %s"),
|
|
|
|
|
quotearg (optarg));
|
|
|
|
|
tabsize = (int) tmp_long;
|
|
|
|
|
|
|
|
|
|
|