summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-04-23 17:32:25 +0000
committerJim Meyering <jim@meyering.net>2004-04-23 17:32:25 +0000
commite356a9a6eaed7d341bad7033511200fbe57c9cd8 (patch)
treef755c43d51434724e2f70ab6c97202a62e575ce5 /src/ls.c
parent656883d77569da9fda7e8bb796e155019a25f965 (diff)
downloadcoreutils-e356a9a6eaed7d341bad7033511200fbe57c9cd8.tar.xz
Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
(quote_name): Use SIZE_MAX, not -1, in calls of quotearg_buffer. Patch by Mikulas Patocka.
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ls.c b/src/ls.c
index a96cdbaf8..6b9b89c57 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3231,7 +3231,8 @@ quote_name (FILE *out, const char *name, struct quoting_options const *options,
size_t *width)
{
char smallbuf[BUFSIZ];
- size_t len = quotearg_buffer (smallbuf, sizeof smallbuf, name, -1, options);
+ size_t len = quotearg_buffer (smallbuf, sizeof smallbuf, name, SIZE_MAX,
+ options);
char *buf;
size_t displayed_width IF_LINT (= 0);
@@ -3240,7 +3241,7 @@ quote_name (FILE *out, const char *name, struct quoting_options const *options,
else
{
buf = alloca (len + 1);
- quotearg_buffer (buf, len + 1, name, -1, options);
+ quotearg_buffer (buf, len + 1, name, SIZE_MAX, options);
}
if (qmark_funny_chars)