Browse Source

[img2term] check if the image size is negative

rexim 2 years ago
parent
commit
fee36aa0d9
1 changed files with 5 additions and 0 deletions
  1. 5 0
      img2term.c

+ 5 - 0
img2term.c

@@ -622,6 +622,11 @@ int main(int argc, char **argv)
             }
 
             resized_width = atoi(shift_args(&argc, &argv));
+
+            if (resized_width < 0) {
+                fprintf(stderr, "ERROR: the value of %s can't be negative\n", flag);
+                exit(1);
+            }
         } else {
             const char *file_path = flag;