summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-08-26 14:45:16 +0000
committerJim Meyering <jim@meyering.net>1998-08-26 14:45:16 +0000
commit93449adfa44b53b8b961a2a64f60d6d8ab0680ac (patch)
tree1d2f8234dcabb5749d6b1e5f2993cacf4004d189 /src
parent21041064bdc964b12fff1bc859d165a5a46b5580 (diff)
downloadcoreutils-93449adfa44b53b8b961a2a64f60d6d8ab0680ac.tar.xz
(dc_parse_stream): Don't segfault when a line
contains only one token. Reported by Olav Morkrid.
Diffstat (limited to 'src')
-rw-r--r--src/dircolors.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dircolors.c b/src/dircolors.c
index 96ede3714..0fb236faf 100644
--- a/src/dircolors.c
+++ b/src/dircolors.c
@@ -292,6 +292,15 @@ dc_parse_stream (FILE *fp, const char *filename)
if (keywd == NULL)
continue;
+ if (arg == NULL)
+ {
+ error (0, 0, _("%s:%lu: invalid line; missing second token"),
+ filename, (long unsigned) line_number);
+ err = 1;
+ free (keywd);
+ continue;
+ }
+
unrecognized = 0;
if (strcasecmp (keywd, "TERM") == 0)
{