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-dns-engine-5.3/dhis-dns-engine.c Examining data/dhis-dns-engine-5.3/nsupdate.c FINAL RESULTS: data/dhis-dns-engine-5.3/dhis-dns-engine.c:49: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-dns-engine-5.3/dhis-dns-engine.c:115: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-dns-engine-5.3/dhis-dns-engine.c:118: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-dns-engine-5.3/dhis-dns-engine.c:190: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-dns-engine-5.3/dhis-dns-engine.c:194: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-dns-engine-5.3/dhis-dns-engine.c:238: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-dns-engine-5.3/dhis-dns-engine.c:276:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"%s.",host); data/dhis-dns-engine-5.3/dhis-dns-engine.c:289: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(str2,OFFLINE_IP); data/dhis-dns-engine-5.3/dhis-dns-engine.c:290:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"%s.",host); data/dhis-dns-engine-5.3/dhis-dns-engine.c:320: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(addr,line_entry(4,line)); data/dhis-dns-engine-5.3/dhis-dns-engine.c:322:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(logstr,"-> online %s [%s]", data/dhis-dns-engine-5.3/dhis-dns-engine.c:332: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(addr,line_entry(4,line)); data/dhis-dns-engine-5.3/dhis-dns-engine.c:335:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(logstr,"-> update %s [%s]",db_hostname(id), data/dhis-dns-engine-5.3/dhis-dns-engine.c:345: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(addr,line_entry(4,line)); data/dhis-dns-engine-5.3/dhis-dns-engine.c:347:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(logstr,"-> offline %s [%s]",db_hostname(id), data/dhis-dns-engine-5.3/nsupdate.c:51:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"update add %s %d IN ",r_dname,r_ttl); data/dhis-dns-engine-5.3/nsupdate.c:53:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"update delete %s IN ",r_dname); data/dhis-dns-engine-5.3/nsupdate.c:61:9: [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(str,r_data); data/dhis-dns-engine-5.3/nsupdate.c:88:4: [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. r=execlp(NSUPDATE_CMD,NSUPDATE_CMD,"-d",NULL); data/dhis-dns-engine-5.3/dhis-dns-engine.c:83:4: [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 fqdn[MAX_HOSTNAME]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:110: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[256]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:112: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-dns-engine-5.3/dhis-dns-engine.c:113: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-dns-engine-5.3/dhis-dns-engine.c:117: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-dns-engine-5.3/dhis-dns-engine.c:136:9: [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 char b2[1024],*pb2; data/dhis-dns-engine-5.3/dhis-dns-engine.c:167: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 str[1024]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:172: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-dns-engine-5.3/dhis-dns-engine.c:180:3: [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 keyword[256]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:185: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-dns-engine-5.3/dhis-dns-engine.c:230:9: [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 char host[MAX_HOSTNAME]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:269: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 str[128]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:284: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 str[128],str2[16]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:299: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 line[1024]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:302: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 DNS Engine Starting"); data/dhis-dns-engine-5.3/dhis-dns-engine.c:317:4: [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 addr[128]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:318:4: [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 logstr[128]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:319: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-dns-engine-5.3/dhis-dns-engine.c:329:4: [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 addr[128]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:330:4: [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 logstr[128]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:331: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-dns-engine-5.3/dhis-dns-engine.c:342:4: [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 addr[128]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:343:4: [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 logstr[128]; data/dhis-dns-engine-5.3/dhis-dns-engine.c:344: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-dns-engine-5.3/nsupdate.c:47:9: [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 str[1024]; data/dhis-dns-engine-5.3/nsupdate.c:56:25: [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. if(r_type==T_A) strcat(str,"A "); data/dhis-dns-engine-5.3/nsupdate.c:57:31: [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. else if(r_type==T_MX) strcat(str,"MX "); data/dhis-dns-engine-5.3/nsupdate.c:58:34: [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. else if(r_type==T_CNAME) strcat(str,"CNAME "); data/dhis-dns-engine-5.3/nsupdate.c:85:2: [2] (misc) open: 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). open("/dev/null",O_WRONLY,0666); data/dhis-dns-engine-5.3/nsupdate.c:86:2: [2] (misc) open: 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). open("/dev/null",O_WRONLY,0666); data/dhis-dns-engine-5.3/dhis-dns-engine.c:119: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"); data/dhis-dns-engine-5.3/dhis-dns-engine.c:278:33: [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). dns_update(str,ADD,T_A,DYN_TTL,strlen(addr),addr); data/dhis-dns-engine-5.3/dhis-dns-engine.c:292:33: [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). dns_update(str,ADD,T_A,DYN_TTL,strlen(str2),str2); data/dhis-dns-engine-5.3/nsupdate.c:62:9: [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(str,"\n"); data/dhis-dns-engine-5.3/nsupdate.c:63:9: [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(str,"\n"); data/dhis-dns-engine-5.3/nsupdate.c:72:22: [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). write(fildes[1],str,strlen(str)+1); ANALYSIS SUMMARY: Hits = 55 Lines analyzed = 453 in approximately 0.03 seconds (16845 lines/second) Physical Source Lines of Code (SLOC) = 311 Hits@level = [0] 0 [1] 6 [2] 30 [3] 0 [4] 19 [5] 0 Hits@level+ = [0+] 55 [1+] 55 [2+] 49 [3+] 19 [4+] 19 [5+] 0 Hits/KSLOC@level+ = [0+] 176.849 [1+] 176.849 [2+] 157.556 [3+] 61.0932 [4+] 61.0932 [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.