[PATCH] gozilla: More robust input error handling

Punit Agrawal <[email protected]>
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <[email protected]>
From: Punit Agrawal <[email protected]>

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.