2
0
Эх сурвалжийг харах

[img2term] check if the image size is negative

rexim 2 жил өмнө
parent
commit
fee36aa0d9
1 өөрчлөгдсөн 5 нэмэгдсэн , 0 устгасан
  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));
             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 {
         } else {
             const char *file_path = flag;
             const char *file_path = flag;