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/dhis-tools-dns-5.0/genpass.c Examining data/dhis-tools-dns-5.0/genkeys.c Examining data/dhis-tools-dns-5.0/genid.c FINAL RESULTS: data/dhis-tools-dns-5.0/genkeys.c:52:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(buff,temp); data/dhis-tools-dns-5.0/genkeys.c:46:22: [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. if(!seed) { seed++; srandom(time(NULL)); } data/dhis-tools-dns-5.0/genkeys.c:51:22: [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. sprintf(temp,"%lu",random()); data/dhis-tools-dns-5.0/genpass.c:39:2: [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(time(NULL)); data/dhis-tools-dns-5.0/genpass.c:42: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. i=random() % ('z'+1); data/dhis-tools-dns-5.0/genid.c:45:18: [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. static unsigned char b2[1024],*pb2; data/dhis-tools-dns-5.0/genid.c:76:11: [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. unsigned char str[1024]; data/dhis-tools-dns-5.0/genid.c:79:5: [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("/etc/dhis-server/dhis.db","r"); data/dhis-tools-dns-5.0/genid.c:84:7: [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). if(atoi(line_entry(1,str)) > id) id=atoi(line_entry(1,str)); data/dhis-tools-dns-5.0/genid.c:84:40: [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). if(atoi(line_entry(1,str)) > id) id=atoi(line_entry(1,str)); data/dhis-tools-dns-5.0/genkeys.c:43:2: [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 buff[1024],temp[128]; data/dhis-tools-dns-5.0/genkeys.c:51:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(temp,"%lu",random()); data/dhis-tools-dns-5.0/genkeys.c:98:11: [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. unsigned char buff[1024]; data/dhis-tools-dns-5.0/genkeys.c:99:11: [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. unsigned char chunk[128]; data/dhis-tools-dns-5.0/genkeys.c:107:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(chunk,cp,50); data/dhis-tools-dns-5.0/genpass.c:52:11: [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. unsigned char pass[16]; data/dhis-tools-dns-5.0/genkeys.c:54:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). } while(strlen(buff) < n); ANALYSIS SUMMARY: Hits = 17 Lines analyzed = 280 in approximately 0.03 seconds (9281 lines/second) Physical Source Lines of Code (SLOC) = 134 Hits@level = [0] 3 [1] 1 [2] 11 [3] 4 [4] 1 [5] 0 Hits@level+ = [0+] 20 [1+] 17 [2+] 16 [3+] 5 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 149.254 [1+] 126.866 [2+] 119.403 [3+] 37.3134 [4+] 7.46269 [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.