[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gozilla: More robust input error handling
From: |
Punit Agrawal |
Subject: |
[PATCH] gozilla: More robust input error handling |
Date: |
Sat, 21 Oct 2017 11:46:37 +0100 |
From: Punit Agrawal <address@hidden>
The check for argc only tests if it is zero rather than any value less
than equal 0. This leads to segmentation fault when fed with invalid
input (Debian bug #715980).
Fix this by erroring out if argc <= 0.
[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=715980
---
Hi,
The debian bug report includes a reproducer. The patch below fixes the
issue for me and should be considered for upstream inclusion.
Thanks,
Punit
gozilla/gozilla.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gozilla/gozilla.c b/gozilla/gozilla.c
index 22d2a95..050d228 100644
--- a/gozilla/gozilla.c
+++ b/gozilla/gozilla.c
@@ -273,7 +273,7 @@ main(int argc, char **argv)
* Replace alias name.
*/
if (definition == NULL) {
- if (argc == 0)
+ if (argc <= 0)
usage();
strbuf_puts(arg, argv[0]);
/*
--
2.14.2
- [PATCH] gozilla: More robust input error handling,
Punit Agrawal <=