comparison resize-gd.c @ 17:159402d54c29 default tip

replaced atoi with strtol, which is more secure
author meillo@marmaro.de
date Tue, 22 Jul 2008 10:07:27 +0200
parents c50716420346
children
comparison
equal deleted inserted replaced
16:9674ada28cfe 17:159402d54c29
116 usage(); 116 usage();
117 exit(2); 117 exit(2);
118 } 118 }
119 119
120 /* parse width and height */ 120 /* parse width and height */
121 sizeopt.w = atoi(argv[1]); 121 sizeopt.w = (int) strtol(argv[1], (char**)NULL, 10);
122 c = strchr(argv[1], 'x'); 122 c = strchr(argv[1], 'x');
123 if (c && c[1] != '\0') { 123 if (c && c[1] != '\0') {
124 sizeopt.h = atoi(c + 1); 124 sizeopt.h = (int) strtol(c+1, (char**)NULL, 10);
125 } else { 125 } else {
126 sizeopt.h = -1; /* keep aspect ratio */ 126 sizeopt.h = -1; /* keep aspect ratio */
127 } 127 }
128 128
129 129