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/cpqarrayd-2.3.6/cciss_functions.c Examining data/cpqarrayd-2.3.6/cciss_functions.h Examining data/cpqarrayd-2.3.6/cciss_structs.h Examining data/cpqarrayd-2.3.6/cpqarrayd.c Examining data/cpqarrayd-2.3.6/cpqarrayd.h Examining data/cpqarrayd-2.3.6/discover.c Examining data/cpqarrayd-2.3.6/discover.h Examining data/cpqarrayd-2.3.6/sendtrap.c Examining data/cpqarrayd-2.3.6/sendtrap.h Examining data/cpqarrayd-2.3.6/status.c Examining data/cpqarrayd-2.3.6/status.h FINAL RESULTS: data/cpqarrayd-2.3.6/cpqarrayd.c:102:19: [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. #define DEBUG(x) fprintf(stderr, x) data/cpqarrayd-2.3.6/cpqarrayd.c:271:8: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ((access("/var/run/cpqarrayd.pid", R_OK | F_OK)) == 0) data/cpqarrayd-2.3.6/cpqarrayd.h:27:24: [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. char debug, verbose, syslog, fork; data/cpqarrayd-2.3.6/discover.c:98:12: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ((access (controllers[cntr], R_OK | F_OK)) == 0) data/cpqarrayd-2.3.6/discover.c:120:12: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ((access (cciss_controllers[cntr], R_OK | F_OK)) == 0) data/cpqarrayd-2.3.6/discover.c:188: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(ctrls_found[ctrls_found_num].devicefile, devicefile); data/cpqarrayd-2.3.6/status.c:124:4: [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(stdout, statusstr[status], data/cpqarrayd-2.3.6/status.c:133:4: [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. syslog(LOG_WARNING, statusstr[status], ctrl_cntr, logd_cntr, data/cpqarrayd-2.3.6/status.c:140:4: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(statusmsg, statusstr[status], ctrl_cntr, logd_cntr, pvalue); data/cpqarrayd-2.3.6/status.c:162:4: [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. syslog(LOG_WARNING, statusstr[status], ctrl_cntr, logd_cntr, data/cpqarrayd-2.3.6/status.c:169:4: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(statusmsg, statusstr[status], ctrl_cntr, logd_cntr, pvalue); data/cpqarrayd-2.3.6/status.c:227:2: [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. syslog(LOG_WARNING, statusmsg); data/cpqarrayd-2.3.6/status.c:229:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (statusmsg); data/cpqarrayd-2.3.6/status.c:247:2: [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. syslog(LOG_WARNING, statusmsg); data/cpqarrayd-2.3.6/status.c:249:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (statusmsg); data/cpqarrayd-2.3.6/cpqarrayd.c:136:20: [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 ((option = getopt (argc, argv, "dfvhst:")) != EOF) data/cpqarrayd-2.3.6/cciss_functions.c:71: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 buffer[128]; data/cpqarrayd-2.3.6/cciss_functions.c:119: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 (logluns, buffer, 128); data/cpqarrayd-2.3.6/cciss_functions.c:128: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 buffer[512]; data/cpqarrayd-2.3.6/cciss_functions.c:183:2: [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 (event, buffer, 512); data/cpqarrayd-2.3.6/cciss_structs.h:174: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 mesgstring[80]; /* Null Terminated ASCII Mesg byte 74-153 */ data/cpqarrayd-2.3.6/cciss_structs.h:179: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 padding[335]; /* padding byte 176-511 */ data/cpqarrayd-2.3.6/cpqarrayd.c:129: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 buffer[1024]; data/cpqarrayd-2.3.6/cpqarrayd.c:234:17: [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). pidfile = fopen ("/var/run/cpqarrayd.pid","w"); data/cpqarrayd-2.3.6/cpqarrayd.c:246:11: [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). fd=open("/dev/null", O_RDWR); data/cpqarrayd-2.3.6/cpqarrayd.h:28: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 *traphosts[10]; data/cpqarrayd-2.3.6/discover.c:146: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 buffer[30]; data/cpqarrayd-2.3.6/discover.c:152:18: [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). if((devicefd = open (devicefile, O_RDONLY))==-1) data/cpqarrayd-2.3.6/discover.c:251:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq IDA"); data/cpqarrayd-2.3.6/discover.c:254:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq IDA-2"); data/cpqarrayd-2.3.6/discover.c:257:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq IAES"); data/cpqarrayd-2.3.6/discover.c:260:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq SMART"); data/cpqarrayd-2.3.6/discover.c:263:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq SMART-2/E"); data/cpqarrayd-2.3.6/discover.c:266:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq SMART-2/P (2DH)"); data/cpqarrayd-2.3.6/discover.c:269:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq SMART-2SL"); data/cpqarrayd-2.3.6/discover.c:272:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq SMART-3200"); data/cpqarrayd-2.3.6/discover.c:275:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq SMART-3100ES"); data/cpqarrayd-2.3.6/discover.c:278:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq SMART-221"); data/cpqarrayd-2.3.6/discover.c:281:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq Integrated Array"); data/cpqarrayd-2.3.6/discover.c:284:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq Smart Array 4200"); data/cpqarrayd-2.3.6/discover.c:287:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq Smart Array 4250ES"); data/cpqarrayd-2.3.6/discover.c:290:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Compaq Smart Array 431"); data/cpqarrayd-2.3.6/discover.c:297:7: [2] (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). Risk is low because the source is a constant string. strcpy (name, "Unknown Controller Type"); data/cpqarrayd-2.3.6/discover.c:309:19: [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). if((devicefd = open (devicefile, O_RDWR))==-1) data/cpqarrayd-2.3.6/sendtrap.c:55: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 statusmsg[12]; data/cpqarrayd-2.3.6/sendtrap.c:86:5: [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 (pdu->enterprise, enterprise, sizeof(enterprise)); data/cpqarrayd-2.3.6/sendtrap.c:94:5: [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(statusmsg, "%d", status); data/cpqarrayd-2.3.6/status.c:64: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 statusmsg[1024]; data/cpqarrayd-2.3.6/status.c:75:16: [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). devicefd = open (ctrls_found[ctrl_cntr].devicefile, O_RDONLY); data/cpqarrayd-2.3.6/status.c:203: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 statusmsg[2048]; data/cpqarrayd-2.3.6/status.c:215:16: [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). devicefd = open (ctrls_found[ctrl_cntr].devicefile, O_RDONLY); data/cpqarrayd-2.3.6/cpqarrayd.c:202:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(buffer, "(none)", HOST_NAME_MAX); data/cpqarrayd-2.3.6/discover.c:187:60: [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). ctrls_found[ctrls_found_num].devicefile = (char *)malloc(strlen(devicefile)+1); data/cpqarrayd-2.3.6/sendtrap.c:70:29: [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). session.community_len = strlen(session.community); ANALYSIS SUMMARY: Hits = 54 Lines analyzed = 1584 in approximately 0.09 seconds (18610 lines/second) Physical Source Lines of Code (SLOC) = 1042 Hits@level = [0] 54 [1] 3 [2] 35 [3] 1 [4] 15 [5] 0 Hits@level+ = [0+] 108 [1+] 54 [2+] 51 [3+] 16 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 103.647 [1+] 51.8234 [2+] 48.9443 [3+] 15.3551 [4+] 14.3954 [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.