Skip to content

Commit

Permalink
shp2img.c: fix Untrusted loop bound (CID 1174460)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 22, 2021
1 parent 13c0f85 commit 04d17b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion shp2img.c
Expand Up @@ -30,7 +30,7 @@
#include "mapserver.h"
#include "maptime.h"


#include "limits.h"

int main(int argc, char *argv[])
{
Expand All @@ -52,6 +52,11 @@ int main(int argc, char *argv[])
for(i=1; i<argc; i++) {
if (strcmp(argv[i],"-c") == 0) { /* user specified number of draws */
iterations = atoi(argv[i+1]);
if( iterations < 0 || iterations > INT_MAX - 1 )
{
printf("Invalid number of iterations");
return 1;
}
printf("We will draw %d times...\n", iterations);
continue;
}
Expand Down

0 comments on commit 04d17b6

Please sign in to comment.