Package: rats
Version: 2.3-1
Severity: normal
Tags: patch
Rats segfaults when passed an invalid command-line option:
$ ./rats --die-rats-die
Segmentation fault
The segfault occurs in getopt_long in main.c; it seems the problem is
simply that the long_options array is missing the requisite final
null-entry.
Patch attached.
diff --git a/main.c b/main.c
index acf02d9..6090db7 100644
--- a/main.c
+++ b/main.c
@@ -281,6 +281,7 @@ int main(int argc, char **argv)
{"columns", 0,0,0},
{"context", 0,0,0},
{"all-static", 0,0,0},
+ {0,0,0,0},
};
progname = argv[0];
flags|=RECURSIVE_FILE_SCAN;