Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/crossfire-maps-1.71.0/Info/land.c Examining data/crossfire-maps-1.71.0/scorn/houses/easy_house.1.c FINAL RESULTS: data/crossfire-maps-1.71.0/Info/land.c:197:6: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(name,MAP_FORMAT,nx,ny); data/crossfire-maps-1.71.0/Info/land.c:213:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(fp,MAP_FORMAT,nx, ny-1); data/crossfire-maps-1.71.0/Info/land.c:218:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(fp,MAP_FORMAT,nx+1, ny); data/crossfire-maps-1.71.0/Info/land.c:223:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(fp,MAP_FORMAT,nx, ny+1); data/crossfire-maps-1.71.0/Info/land.c:228:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(fp,MAP_FORMAT,nx-1, ny); data/crossfire-maps-1.71.0/Info/land.c:253:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(fp, Terrain_Names[terrain[x + y * mapx]][1]); data/crossfire-maps-1.71.0/Info/land.c:125:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. x = random() % mapx; data/crossfire-maps-1.71.0/Info/land.c:126:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. y = random() % mapy; data/crossfire-maps-1.71.0/Info/land.c:133:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. r1 = random(); data/crossfire-maps-1.71.0/Info/land.c:134:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. r2 = random(); data/crossfire-maps-1.71.0/Info/land.c:143:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. random() % 2) continue; data/crossfire-maps-1.71.0/Info/land.c:165:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. r1 = random(); data/crossfire-maps-1.71.0/Info/land.c:166:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. r2 = random(); data/crossfire-maps-1.71.0/Info/land.c:272:17: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt(argc, argv,"x:y:X:Y:s:l:n:w:p:m"))!=-1) { data/crossfire-maps-1.71.0/Info/land.c:339:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom(seed); data/crossfire-maps-1.71.0/Info/land.c:362:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. x = random()%max_x; data/crossfire-maps-1.71.0/Info/land.c:363:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. y = random()%max_y; data/crossfire-maps-1.71.0/Info/land.c:367:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random() % 2) { data/crossfire-maps-1.71.0/Info/land.c:368:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. x += random()%max_x; data/crossfire-maps-1.71.0/Info/land.c:369:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. y += random()%max_y; data/crossfire-maps-1.71.0/Info/land.c:373:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. n = random()%500+800; data/crossfire-maps-1.71.0/Info/land.c:379:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. x = random()%max_x; data/crossfire-maps-1.71.0/Info/land.c:380:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. y = random()%max_y; data/crossfire-maps-1.71.0/Info/land.c:381:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random() % 2) { data/crossfire-maps-1.71.0/Info/land.c:382:12: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. x += random()%max_x; data/crossfire-maps-1.71.0/Info/land.c:383:12: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. y += random()%max_y; data/crossfire-maps-1.71.0/Info/land.c:397:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. r = random()%4; data/crossfire-maps-1.71.0/Info/land.c:399:41: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. case 0: if (x<max_x-1) x++; else x -= random() % (max_x/2); break; data/crossfire-maps-1.71.0/Info/land.c:400:41: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. case 1: if (y<max_y-1) y++; else y -= random() % (max_y/2); break; data/crossfire-maps-1.71.0/Info/land.c:401:32: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. case 2: if (x) x--; else x+= random() % (max_x/2); break; data/crossfire-maps-1.71.0/Info/land.c:402:32: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. case 3: if (y) y--; else y+= random() % (max_y/2); break; data/crossfire-maps-1.71.0/Info/land.c:405:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random()%k < 100) data/crossfire-maps-1.71.0/Info/land.c:417:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. n = random()%1500-2000; data/crossfire-maps-1.71.0/Info/land.c:419:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. x = random()% max_x; data/crossfire-maps-1.71.0/Info/land.c:420:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. y = random()% max_y; data/crossfire-maps-1.71.0/Info/land.c:423:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. x = random()% max_x; data/crossfire-maps-1.71.0/Info/land.c:424:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. y = random()% max_y; data/crossfire-maps-1.71.0/Info/land.c:427:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. r = random()%4; data/crossfire-maps-1.71.0/Info/land.c:435:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random()%k < 100) data/crossfire-maps-1.71.0/Info/land.c:95:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[512]; data/crossfire-maps-1.71.0/Info/land.c:198:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fp=fopen(name, "w"))==NULL) { data/crossfire-maps-1.71.0/Info/land.c:249:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen("cmap", "w"); data/crossfire-maps-1.71.0/Info/land.c:275:10: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). land = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:283:11: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). water = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:291:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). wpasses = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:299:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). npasses = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:307:11: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). max_x = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:311:11: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). max_y = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:315:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). startx = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:318:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). starty = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:321:10: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). seed = atoi(optarg); data/crossfire-maps-1.71.0/Info/land.c:504:7: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen("lmap", "w"); data/crossfire-maps-1.71.0/Info/land.c:505:7: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). lp = fopen("pmap", "w"); ANALYSIS SUMMARY: Hits = 53 Lines analyzed = 2259 in approximately 0.56 seconds (4046 lines/second) Physical Source Lines of Code (SLOC) = 2143 Hits@level = [0] 50 [1] 0 [2] 14 [3] 33 [4] 6 [5] 0 Hits@level+ = [0+] 103 [1+] 53 [2+] 53 [3+] 39 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 48.0635 [1+] 24.7317 [2+] 24.7317 [3+] 18.1988 [4+] 2.79981 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.