[hackers] [sent] Fix cmdline argument check

From: Quentin Rameau <quinq_AT_fifth.space>
Date: Sat, 5 Mar 2016 21:07:50 +0100

There was a segfault when sent was called without arguments.
Now we use stdin when there's no argument or - is used.
Thanks to izabera for the report.
---
 sent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sent.c b/sent.c
index 6f5c139..2a27acd 100644
--- a/sent.c
+++ b/sent.c
_AT_@ -703,7 +703,7 @@ main(int argc, char *argv[])
 		usage();
 	} ARGEND;
 
-	if ((fp = strcmp(argv[0], "-") ? fopen(argv[0], "r") : stdin)) {
+	if ((fp = ((argv[0] && strcmp(argv[0], "-")) ? fopen(argv[0], "r") : stdin))) {
 		load(fp);
 		fclose(fp);
 	} else {
-- 
2.7.2
Received on Sat Mar 05 2016 - 21:07:50 CET

This archive was generated by hypermail 2.3.0 : Sat Mar 05 2016 - 21:12:15 CET