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/resource-agents-4.6.1/heartbeat/IPv6addr.c Examining data/resource-agents-4.6.1/heartbeat/IPv6addr_utils.c Examining data/resource-agents-4.6.1/heartbeat/send_ua.c Examining data/resource-agents-4.6.1/include/IPv6addr.h Examining data/resource-agents-4.6.1/tools/findif.c Examining data/resource-agents-4.6.1/tools/send_arp.libnet.c Examining data/resource-agents-4.6.1/tools/send_arp.linux.c Examining data/resource-agents-4.6.1/tools/sfex.h Examining data/resource-agents-4.6.1/tools/sfex_daemon.c Examining data/resource-agents-4.6.1/tools/sfex_init.c Examining data/resource-agents-4.6.1/tools/sfex_lib.c Examining data/resource-agents-4.6.1/tools/sfex_lib.h Examining data/resource-agents-4.6.1/tools/sfex_stat.c Examining data/resource-agents-4.6.1/tools/tickle_tcp.c FINAL RESULTS: data/resource-agents-4.6.1/heartbeat/IPv6addr.c:261:6: [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(IF_INET6, R_OK)) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:545: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(ifr.ifr_name, if_name); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:574: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(ifr.ifr_name, if_name); data/resource-agents-4.6.1/heartbeat/send_ua.c:99:6: [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(IF_INET6, R_OK)) { data/resource-agents-4.6.1/tools/findif.c:254:12: [4] (shell) popen: 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. routefd = popen (routecmd, "r"); data/resource-agents-4.6.1/tools/sfex_daemon.c:104:3: [4] (shell) execl: 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. execl("/usr/sbin/crm_resource", "crm_resource", "-F", "-r", rsc_id, "--node", nodename, NULL); data/resource-agents-4.6.1/tools/tickle_tcp.c:358:3: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(addrline, "%s %s", addr1, addr2); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:212:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. ipv6addr = getenv("OCF_RESKEY_ipv6addr"); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:232:17: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. cidr_netmask = getenv("OCF_RESKEY_cidr_netmask"); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:252:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. prov_ifname = getenv("OCF_RESKEY_nic"); data/resource-agents-4.6.1/heartbeat/send_ua.c:57:15: [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 ((ch = getopt(argc, argv, "h?c:i:")) != EOF) { data/resource-agents-4.6.1/tools/findif.c:374:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. *address = getenv("OCF_RESKEY_ip"); data/resource-agents-4.6.1/tools/findif.c:375:17: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. *netmaskbits = getenv("OCF_RESKEY_cidr_netmask"); data/resource-agents-4.6.1/tools/findif.c:377:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. *netmaskbits = getenv("OCF_RESKEY_netmask"); data/resource-agents-4.6.1/tools/findif.c:379:15: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. *bcast_arg = getenv("OCF_RESKEY_broadcast"); data/resource-agents-4.6.1/tools/findif.c:380:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. *if_specified = getenv("OCF_RESKEY_nic"); data/resource-agents-4.6.1/tools/send_arp.libnet.c:161: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 ((flag = getopt(argc, argv, "i:r:p:")) != EOF) { data/resource-agents-4.6.1/tools/send_arp.linux.c:1085:15: [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 ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:Vr:i:p:")) != EOF) { data/resource-agents-4.6.1/tools/sfex_daemon.c:204:11: [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. int c = getopt(argc, argv, "hi:c:t:m:n:r:"); data/resource-agents-4.6.1/tools/sfex_init.c:114:13: [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. int c = getopt(argc, argv, "hn:"); data/resource-agents-4.6.1/tools/sfex_stat.c:151:13: [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. int c = getopt(argc, argv, "hi:"); data/resource-agents-4.6.1/tools/tickle_tcp.c:338:13: [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. optchar = getopt(argc, argv, OPTION_STRING); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:182: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 pid_file[256]; data/resource-agents-4.6.1/heartbeat/IPv6addr.c:222:16: [2] (integer) atol: 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). prefix_len = atol(cp + 1); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:235:8: [2] (integer) atol: 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 ((atol(cidr_netmask) < 0) || (atol(cidr_netmask) > 128)) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:235:36: [2] (integer) atol: 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 ((atol(cidr_netmask) < 0) || (atol(cidr_netmask) > 128)) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:241:41: [2] (integer) atol: 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 (prefix_len != -1 && prefix_len != atol(cidr_netmask)) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:245:16: [2] (integer) atol: 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). prefix_len = atol(cidr_netmask); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:417: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 devname[21]=""; data/resource-agents-4.6.1/heartbeat/IPv6addr.c:424:11: [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 ((f = fopen(IF_INET6, "r")) == NULL) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:616: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(&outpack, &icmph, sizeof(icmph)); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:621: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(&addr.sin6_addr,addr6,sizeof(struct in6_addr)); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:716: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 pidbuf[11]; data/resource-agents-4.6.1/heartbeat/IPv6addr.c:731:15: [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). pidfilefd = open(pid_file, O_CREAT|O_EXCL|O_RDWR, data/resource-agents-4.6.1/heartbeat/IPv6addr.c:745:15: [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). pidfilefd = open(pid_file, O_RDONLY, S_IRUSR|S_IWUSR); data/resource-agents-4.6.1/heartbeat/IPv6addr_utils.c:124: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(payload + sizeof(struct nd_neighbor_advert) data/resource-agents-4.6.1/heartbeat/send_ua.c:60:12: [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). count = atoi(optarg); data/resource-agents-4.6.1/heartbeat/send_ua.c:63:15: [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). interval = atoi(optarg); data/resource-agents-4.6.1/tools/findif.c:185: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 buf[2048]; data/resource-agents-4.6.1/tools/findif.c:186: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 interface[MAXSTR]; data/resource-agents-4.6.1/tools/findif.c:189: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). if ((routefd = fopen(PROCROUTE, "r")) == NULL) { data/resource-agents-4.6.1/tools/findif.c:240: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 mask[20]; data/resource-agents-4.6.1/tools/findif.c:241: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 routecmd[MAXSTR]; data/resource-agents-4.6.1/tools/findif.c:243: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 buf[2048]; data/resource-agents-4.6.1/tools/findif.c:244: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 interface[MAXSTR]; data/resource-agents-4.6.1/tools/findif.c:394: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). return atoi(netmaskbits); data/resource-agents-4.6.1/tools/findif.c:466: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 buf[512]; data/resource-agents-4.6.1/tools/findif.c:475: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). fd = fopen(PATH_PROC_NET_DEV, "r"); data/resource-agents-4.6.1/tools/findif.c:490: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 name[IFNAMSIZ]; data/resource-agents-4.6.1/tools/findif.c:571: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 best_if[MAXSTR]; data/resource-agents-4.6.1/tools/findif.c:649: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 errmsg[MAXSTR] = "No valid mechanisms"; data/resource-agents-4.6.1/tools/findif.c:652:3: [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(best_if, "UNKNOWN"); data/resource-agents-4.6.1/tools/send_arp.libnet.c:99:24: [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 int get_hw_addr(char *device, u_char mac[6]); data/resource-agents-4.6.1/tools/send_arp.libnet.c:131: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 errbuf[LIBNET_ERRBUF_SIZE]; data/resource-agents-4.6.1/tools/send_arp.libnet.c:143: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 pidfilenamebuf[64]; data/resource-agents-4.6.1/tools/send_arp.libnet.c:164:25: [2] (integer) atol: 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). case 'i': msinterval= atol(optarg); data/resource-agents-4.6.1/tools/send_arp.libnet.c:167:26: [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). case 'r': repeatcount= atoi(optarg); data/resource-agents-4.6.1/tools/send_arp.libnet.c:345: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. get_hw_addr(char *device, u_char mac[6]) data/resource-agents-4.6.1/tools/send_arp.libnet.c:349: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 err_buf[LIBNET_ERRBUF_SIZE]; data/resource-agents-4.6.1/tools/send_arp.libnet.c:363: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(mac, mac_address->ether_addr_octet, 6); data/resource-agents-4.6.1/tools/send_arp.libnet.c:371: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. get_hw_addr(char *device, u_char mac[6]) data/resource-agents-4.6.1/tools/send_arp.libnet.c:375: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 err_buf[LIBNET_ERRBUF_SIZE]; data/resource-agents-4.6.1/tools/send_arp.libnet.c:389: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(mac, mac_address->ether_addr_octet, 6); data/resource-agents-4.6.1/tools/send_arp.libnet.c:646: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 pidbuf[11]; data/resource-agents-4.6.1/tools/send_arp.libnet.c:661:15: [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). pidfilefd = open(pidfilename, O_CREAT|O_EXCL|O_RDWR, data/resource-agents-4.6.1/tools/send_arp.libnet.c:675:15: [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). pidfilefd = open(pidfilename, O_RDONLY, S_IRUSR|S_IWUSR); data/resource-agents-4.6.1/tools/send_arp.linux.c:333: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 buf[256]; data/resource-agents-4.6.1/tools/send_arp.linux.c:345: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(p, &ME->sll_addr, ah->ar_hln); data/resource-agents-4.6.1/tools/send_arp.linux.c:348: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(p, &src, 4); data/resource-agents-4.6.1/tools/send_arp.linux.c:352: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(p, &ME->sll_addr, ah->ar_hln); data/resource-agents-4.6.1/tools/send_arp.linux.c:354: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(p, &HE->sll_addr, ah->ar_hln); data/resource-agents-4.6.1/tools/send_arp.linux.c:357: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(p, &dst, 4); data/resource-agents-4.6.1/tools/send_arp.linux.c:469: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(&src_ip, p+ah->ar_hln, 4); data/resource-agents-4.6.1/tools/send_arp.linux.c:470: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(&dst_ip, p+ah->ar_hln+4+ah->ar_hln, 4); data/resource-agents-4.6.1/tools/send_arp.linux.c:536: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(((struct sockaddr_ll *)&he)->sll_addr, p, ((struct sockaddr_ll *)&me)->sll_halen); data/resource-agents-4.6.1/tools/send_arp.linux.c:864: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(device.sysfs, &sysfs_devattr_values, sizeof(*device.sysfs)); data/resource-agents-4.6.1/tools/send_arp.linux.c:1021: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(ba, sll->sll_addr, sll->sll_halen); data/resource-agents-4.6.1/tools/send_arp.linux.c:1038: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(ba, v->value[SYSFS_DEVATTR_BROADCAST].ptr, balen); data/resource-agents-4.6.1/tools/send_arp.linux.c:1108:12: [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). count = atoi(optarg); data/resource-agents-4.6.1/tools/send_arp.linux.c:1111:14: [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). timeout = atoi(optarg); data/resource-agents-4.6.1/tools/send_arp.linux.c:1214: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(&dst, hp->h_addr, 4); data/resource-agents-4.6.1/tools/send_arp.linux.c:1316: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 packet[4096]; data/resource-agents-4.6.1/tools/sfex.h:100: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 magic[4]; /* magic number */ data/resource-agents-4.6.1/tools/sfex.h:147: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 nodename[256]; /* node name */ data/resource-agents-4.6.1/tools/sfex_daemon.c:303:13: [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). sysrq_fd = open("/proc/sysrq-trigger", O_WRONLY); data/resource-agents-4.6.1/tools/sfex_lib.c:58:14: [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). dev_fd = open (device, O_RDWR | O_DIRECT | O_SYNC); data/resource-agents-4.6.1/tools/sfex_lib.c:334: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 (cdata->magic, block->magic, 4); data/resource-agents-4.6.1/tools/sfex_lib.c:346:20: [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). cdata->version = atoi ((char *) (block->version)); data/resource-agents-4.6.1/tools/sfex_lib.c:353:21: [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). cdata->revision = atoi ((char *) (block->revision)); data/resource-agents-4.6.1/tools/sfex_lib.c:354:22: [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). cdata->blocksize = atoi ((char *) (block->blocksize)); data/resource-agents-4.6.1/tools/sfex_lib.c:355:21: [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). cdata->numlocks = atoi ((char *) (block->numlocks)); data/resource-agents-4.6.1/tools/sfex_lib.c:428:18: [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). ldata->count = atoi ((char *) (block->count)); data/resource-agents-4.6.1/tools/tickle_tcp.c:335: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 addrline[128], addr1[64], addr2[64]; data/resource-agents-4.6.1/tools/tickle_tcp.c:341: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). num = atoi(optarg); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:206:43: [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). if (0 == strncmp(META_DATA_CMD, argv[1], strlen(META_DATA_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:281:38: [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). if (0 == strncmp(START_CMD,argv[1], strlen(START_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:283:43: [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). }else if (0 == strncmp(STOP_CMD,argv[1], strlen(STOP_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:285:45: [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). }else if (0 == strncmp(STATUS_CMD,argv[1], strlen(STATUS_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:287:45: [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). }else if (0 ==strncmp(MONITOR_CMD,argv[1], strlen(MONITOR_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:289:44: [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). }else if (0 ==strncmp(RELOAD_CMD,argv[1], strlen(RELOAD_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:291:45: [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). }else if (0 ==strncmp(RECOVER_CMD,argv[1], strlen(RECOVER_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:293:46: [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). }else if (0 ==strncmp(VALIDATE_CMD,argv[1], strlen(VALIDATE_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:296:42: [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). }else if (0 ==strncmp(ADVT_CMD,argv[1], strlen(MONITOR_CMD))) { data/resource-agents-4.6.1/heartbeat/IPv6addr.c:435:7: [1] (buffer) fscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. i = fscanf(f, "%08x%08x%08x%08x %x %02x %02x %02x %20s\n", data/resource-agents-4.6.1/heartbeat/IPv6addr.c:754:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes = read(pidfilefd, pidbuf, sizeof(pidbuf)-1); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:809:36: [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). bytes = write(pidfilefd, pidbuf, strlen(pidbuf)); data/resource-agents-4.6.1/heartbeat/IPv6addr.c:810:16: [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). if (bytes != strlen(pidbuf)) { data/resource-agents-4.6.1/heartbeat/IPv6addr_utils.c:96:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name) - 1); data/resource-agents-4.6.1/heartbeat/IPv6addr_utils.c:105:12: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. payload = memalign(sysconf(_SC_PAGESIZE), payload_size); data/resource-agents-4.6.1/heartbeat/send_ua.c:107:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(interval * 1000); data/resource-agents-4.6.1/tools/findif.c:91:27: [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). #define strnlen(str, max) strlen(str) data/resource-agents-4.6.1/tools/findif.c:217:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(best_if, interface, best_iflen); data/resource-agents-4.6.1/tools/findif.c:277:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(mask, cp, sizeof(mask) - 1); data/resource-agents-4.6.1/tools/findif.c:289:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(interface, cp, sizeof(interface) - 1); data/resource-agents-4.6.1/tools/findif.c:310:3: [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 (mask, "255.255.255.255", sizeof(mask)); data/resource-agents-4.6.1/tools/findif.c:323:3: [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 (mask, "0.0.0.0", sizeof(mask)); data/resource-agents-4.6.1/tools/findif.c:346:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(best_if, interface, best_iflen); data/resource-agents-4.6.1/tools/findif.c:427:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr->ifr_name, ifname, IFNAMSIZ - 1); data/resource-agents-4.6.1/tools/findif.c:496:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(output, name, IFNAMSIZ); data/resource-agents-4.6.1/tools/findif.c:547:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifname, start, IFNAMSIZ); data/resource-agents-4.6.1/tools/findif.c:645:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(best_if, if_specified, sizeof(best_if) - 1); data/resource-agents-4.6.1/tools/send_arp.libnet.c:684:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes = read(pidfilefd, pidbuf, sizeof(pidbuf)-1); data/resource-agents-4.6.1/tools/send_arp.libnet.c:740:36: [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). bytes = write(pidfilefd, pidbuf, strlen(pidbuf)); data/resource-agents-4.6.1/tools/send_arp.libnet.c:741:25: [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). if (bytes != (ssize_t)strlen(pidbuf)) { data/resource-agents-4.6.1/tools/send_arp.linux.c:922:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifrbuf.ifr_name, device.name, sizeof(ifrbuf.ifr_name) - 1); data/resource-agents-4.6.1/tools/send_arp.linux.c:1236:71: [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). if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device.name, strlen(device.name)+1) == -1) data/resource-agents-4.6.1/tools/sfex_daemon.c:63:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char*)(ldata.nodename), nodename, sizeof(ldata.nodename) - 1); data/resource-agents-4.6.1/tools/sfex_daemon.c:270: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). if (strlen(optarg) > SFEX_MAX_NODENAME) { data/resource-agents-4.6.1/tools/sfex_lib.c:124:7: [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). if (strlen (u.nodename) > SFEX_MAX_NODENAME) { data/resource-agents-4.6.1/tools/sfex_lib.c:313:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t s = read (dev_fd, block, sector_size); data/resource-agents-4.6.1/tools/sfex_lib.c:395:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t s = read (fd, block, cdata->blocksize); data/resource-agents-4.6.1/tools/sfex_lib.c:429:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy ((char *) (ldata->nodename), (const char *) (block->nodename), sizeof(ldata->nodename)); ANALYSIS SUMMARY: Hits = 132 Lines analyzed = 5958 in approximately 0.24 seconds (24605 lines/second) Physical Source Lines of Code (SLOC) = 4116 Hits@level = [0] 140 [1] 38 [2] 72 [3] 15 [4] 7 [5] 0 Hits@level+ = [0+] 272 [1+] 132 [2+] 94 [3+] 22 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 66.0836 [1+] 32.07 [2+] 22.8377 [3+] 5.345 [4+] 1.70068 [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.