Blob Blame History Raw
Description: Fix segmentation faults due to non correct checking for args
Author: David Suárez <david.sephirot@gmail.com>
Origin: vendor
Bug: https://sourceforge.net/p/giflib/bugs/153/
Bug-Debian: https://bugs.debian.org/715963
Bug-Debian: https://bugs.debian.org/715964
Bug-Debian: https://bugs.debian.org/715967
Last-Update: 2020-12-20

--- a/getarg.c
+++ b/getarg.c
@@ -305,6 +305,12 @@
     int i = 0, ScanRes;
 
     while (!(ISSPACE(CtrlStrCopy[i]))) {
+
+        if ((*argv) == argv_end) {
+            GAErrorToken = Option;
+            return CMD_ERR_NumRead;
+        }
+
         switch (CtrlStrCopy[i + 1]) {
           case 'd':    /* Get signed integers. */
               ScanRes = sscanf(*((*argv)++), "%d",