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-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c FINAL RESULTS: data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:48:10: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #include<syslog.h> data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:92:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(buff,ctime(&tt)); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:95:2: [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,msg); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:164:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(keyword,line_entry(1,str)); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:168:4: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(rec->fqdn,line_entry(2,str)); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:202:4: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(host,p1->fqdn); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:236:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"-> relay %s",fqdn); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:245:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"-qR%s",fqdn); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:252:3: [4] (shell) execlp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execlp(SENDMAIL,"sendmail",str,NULL); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:60:13: [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 fqdn[MAX_HOSTNAME]; data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:87: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[256]; data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:89: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(DHISE_LOG,"a"); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:90:33: [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). while(fp==NULL) { sleep(1); fp=fopen(DHISE_LOG,"a"); } data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:94:2: [2] (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). Risk is low because the source is a constant string. strcat(buff," : "); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:113: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-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:144: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-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:149: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(DHISD_DB,"r"); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:155:12: [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 keyword[256]; data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:159: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). rec->id=atoi(line_entry(1,str)); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:197: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 host[MAX_HOSTNAME]; data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:229: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-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:259: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 line[1024]; data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:262:2: [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(line,"-> DHIS Relay Engine Starting"); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:282: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). id=atoi(line_entry(3,line)); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:288: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). id=atoi(line_entry(3,line)); data/dhis-mx-sendmail-engine-5.0/dhis-mx-sendmail-engine.c:96:2: [1] (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). Risk is low because the source is a constant character. strcat(buff,"\n"); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 297 in approximately 0.03 seconds (10851 lines/second) Physical Source Lines of Code (SLOC) = 215 Hits@level = [0] 0 [1] 1 [2] 16 [3] 0 [4] 9 [5] 0 Hits@level+ = [0+] 26 [1+] 26 [2+] 25 [3+] 9 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 120.93 [1+] 120.93 [2+] 116.279 [3+] 41.8605 [4+] 41.8605 [5+] 0 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.