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


_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global

Reply via email to