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/nsca-2.10.0/include/common.h Examining data/nsca-2.10.0/include/netutils.h Examining data/nsca-2.10.0/include/nsca.h Examining data/nsca-2.10.0/include/utils.h Examining data/nsca-2.10.0/src/netutils.c Examining data/nsca-2.10.0/src/nsca.c Examining data/nsca-2.10.0/src/utils.c Examining data/nsca-2.10.0/src/send_nsca.c FINAL RESULTS: data/nsca-2.10.0/src/send_nsca.c:302: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(&send_packet.host_name[0],host_name); data/nsca-2.10.0/src/send_nsca.c:303: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(&send_packet.svc_description[0],svc_description); data/nsca-2.10.0/src/send_nsca.c:304: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(&send_packet.plugin_output[0],plugin_output); data/nsca-2.10.0/src/nsca.c:1653:10: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. retval=chroot("."); data/nsca-2.10.0/src/utils.c:296:9: [3] (random) srand: 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. srand(seed); data/nsca-2.10.0/src/utils.c:426:2: [3] (random) srand: 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. srand(seed); data/nsca-2.10.0/include/common.h:119: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 host_name[MAX_HOSTNAME_LENGTH]; data/nsca-2.10.0/include/common.h:120: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 svc_description[MAX_DESCRIPTION_LENGTH]; data/nsca-2.10.0/include/common.h:121: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 plugin_output[MAX_PLUGINOUTPUT_LENGTH]; data/nsca-2.10.0/include/common.h:126: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 iv[TRANSMITTED_IV_SIZE]; data/nsca-2.10.0/include/utils.h:37: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 transmitted_iv[TRANSMITTED_IV_SIZE]; data/nsca-2.10.0/src/netutils.c:57: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 server_port[32]; data/nsca-2.10.0/src/netutils.c:67: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(server_port,"%d",port); data/nsca-2.10.0/src/nsca.c:28:8: [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 server_address[64]=""; data/nsca-2.10.0/src/nsca.c:32:8: [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 config_file[MAX_INPUT_BUFFER]="nsca.cfg"; data/nsca-2.10.0/src/nsca.c:33:8: [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 alternate_dump_file[MAX_INPUT_BUFFER]="/dev/null"; data/nsca-2.10.0/src/nsca.c:34:8: [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 command_file[MAX_INPUT_BUFFER]=""; data/nsca-2.10.0/src/nsca.c:35:8: [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 password[MAX_INPUT_BUFFER]=""; data/nsca-2.10.0/src/nsca.c:83: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 buffer[MAX_INPUT_BUFFER]; data/nsca-2.10.0/src/nsca.c:233:4: [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_RDONLY); data/nsca-2.10.0/src/nsca.c:234:4: [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); data/nsca-2.10.0/src/nsca.c:235:4: [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); data/nsca-2.10.0/src/nsca.c:357: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 input_buffer[MAX_INPUT_BUFFER]; data/nsca-2.10.0/src/nsca.c:363:12: [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(filename,"r"); data/nsca-2.10.0/src/nsca.c:399:37: [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). server_port=atoi(varvalue); data/nsca-2.10.0/src/nsca.c:435:43: [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). decryption_method=atoi(varvalue); data/nsca-2.10.0/src/nsca.c:475:28: [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(varvalue)>0) data/nsca-2.10.0/src/nsca.c:481:28: [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(varvalue)>0) data/nsca-2.10.0/src/nsca.c:496:49: [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). checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT,S_IWUSR); data/nsca-2.10.0/src/nsca.c:508:28: [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(varvalue)>0) data/nsca-2.10.0/src/nsca.c:814: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 portbuf[16]; data/nsca-2.10.0/src/nsca.c:934: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 hostbuf[64], portbuf[16]; data/nsca-2.10.0/src/nsca.c:1079:9: [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(&send_packet.iv[0],CI->transmitted_iv,TRANSMITTED_IV_SIZE); data/nsca-2.10.0/src/nsca.c:1139: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 host_name[MAX_HOSTNAME_LENGTH]; data/nsca-2.10.0/src/nsca.c:1140: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 svc_description[MAX_DESCRIPTION_LENGTH]; data/nsca-2.10.0/src/nsca.c:1141: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 plugin_output[MAX_PLUGINOUTPUT_LENGTH]; data/nsca-2.10.0/src/nsca.c:1288:29: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). checkresult_file_fd=mkstemp(checkresult_file); data/nsca-2.10.0/src/nsca.c:1323:34: [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). checkresult_ok_file_fp = fopen(checkresult_ok_file,"w"); data/nsca-2.10.0/src/nsca.c:1369:8: [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(command_file,O_WRONLY|O_NONBLOCK|((append_to_file==TRUE)?O_APPEND:0)); data/nsca-2.10.0/src/nsca.c:1379:21: [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). command_file_fp = fopen(alternate_dump_file, "a"); data/nsca-2.10.0/src/nsca.c:1477: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 pbuf[16]; data/nsca-2.10.0/src/nsca.c:1484:9: [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((fd=open(pid_file,O_RDONLY))>=0){ data/nsca-2.10.0/src/nsca.c:1493: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). pid=(pid_t)atoi(pbuf); data/nsca-2.10.0/src/nsca.c:1508:9: [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((fd=open(pid_file,O_WRONLY | O_CREAT,0644))>=0){ data/nsca-2.10.0/src/nsca.c:1509: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(pbuf,"%d\n",(int)getpid()); data/nsca-2.10.0/src/nsca.c:1563:16: [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). *uid=(uid_t)atoi(user); data/nsca-2.10.0/src/nsca.c:1592:16: [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). *gid=(gid_t)atoi(group); data/nsca-2.10.0/src/send_nsca.c:26:1: [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 server_name[MAX_HOST_ADDRESS_LENGTH]; data/nsca-2.10.0/src/send_nsca.c:27:1: [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 password[MAX_INPUT_BUFFER]=""; data/nsca-2.10.0/src/send_nsca.c:29:1: [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 config_file[MAX_INPUT_BUFFER]="/etc/send_nsca.cfg"; data/nsca-2.10.0/src/send_nsca.c:30:1: [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 delimiter[2]="\t"; data/nsca-2.10.0/src/send_nsca.c:31:1: [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 block_delimiter[2]=BLOCK_DELIMITER; data/nsca-2.10.0/src/send_nsca.c:33:1: [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 received_iv[TRANSMITTED_IV_SIZE]; data/nsca-2.10.0/src/send_nsca.c:67: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 input_buffer[MAX_INPUT_BUFFER]; data/nsca-2.10.0/src/send_nsca.c:68: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 host_name[MAX_HOSTNAME_LENGTH]; data/nsca-2.10.0/src/send_nsca.c:69: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 svc_description[MAX_DESCRIPTION_LENGTH]; data/nsca-2.10.0/src/send_nsca.c:70: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 plugin_output[MAX_PLUGINOUTPUT_LENGTH]; data/nsca-2.10.0/src/send_nsca.c:278:16: [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_code=atoi(ptr2); data/nsca-2.10.0/src/send_nsca.c:283:16: [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_code=atoi(ptr3); data/nsca-2.10.0/src/send_nsca.c:408: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(&received_iv,&receive_packet.iv[0],TRANSMITTED_IV_SIZE); data/nsca-2.10.0/src/send_nsca.c:466:17: [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). server_port=atoi(argv[x]); data/nsca-2.10.0/src/send_nsca.c:476: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). socket_timeout=atoi(argv[x]); data/nsca-2.10.0/src/send_nsca.c:553: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 input_buffer[MAX_INPUT_BUFFER]; data/nsca-2.10.0/src/send_nsca.c:560: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(filename,"r"); data/nsca-2.10.0/src/send_nsca.c:612: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). encryption_method=atoi(varvalue); data/nsca-2.10.0/src/utils.c:106:17: [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(CI->transmitted_iv,received_iv,TRANSMITTED_IV_SIZE); data/nsca-2.10.0/src/utils.c:285:12: [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("/dev/urandom","r"); data/nsca-2.10.0/src/utils.c:416: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("/dev/urandom","r"); data/nsca-2.10.0/src/nsca.c:154:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer,config_file,sizeof(buffer)); data/nsca-2.10.0/src/nsca.c:158:3: [1] (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 character. strcpy(config_file,""); data/nsca-2.10.0/src/nsca.c:162:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(config_file,"/",sizeof(config_file)-2); data/nsca-2.10.0/src/nsca.c:166:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(config_file,buffer,sizeof(config_file)-strlen(config_file)-1); data/nsca-2.10.0/src/nsca.c:166:50: [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). strncat(config_file,buffer,sizeof(config_file)-strlen(config_file)-1); data/nsca-2.10.0/src/nsca.c:406:25: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(server_address,varvalue,sizeof(server_address) - 1); data/nsca-2.10.0/src/nsca.c:410:28: [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(varvalue)>sizeof(command_file)-1){ data/nsca-2.10.0/src/nsca.c:414:25: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(command_file,varvalue,sizeof(command_file)-1); data/nsca-2.10.0/src/nsca.c:418:28: [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(varvalue)>sizeof(alternate_dump_file)-1){ data/nsca-2.10.0/src/nsca.c:422:25: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(alternate_dump_file,varvalue,sizeof(alternate_dump_file)-1); data/nsca-2.10.0/src/nsca.c:426:28: [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(varvalue)>sizeof(password)-1){ data/nsca-2.10.0/src/nsca.c:430:25: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(password,varvalue,sizeof(password)-1); data/nsca-2.10.0/src/nsca.c:487:32: [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(varvalue)>MAX_INPUT_BUFFER-1){ data/nsca-2.10.0/src/nsca.c:1216:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(host_name,receive_packet.host_name,sizeof(host_name)-1); data/nsca-2.10.0/src/nsca.c:1238:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(svc_description,receive_packet.svc_description,sizeof(svc_description)-1); data/nsca-2.10.0/src/nsca.c:1242:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(plugin_output,receive_packet.plugin_output,plugin_length-1); data/nsca-2.10.0/src/nsca.c:1284:19: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask=umask(new_umask); data/nsca-2.10.0/src/nsca.c:1326:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); data/nsca-2.10.0/src/nsca.c:1455:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(config_file,argv[x],sizeof(config_file)-1); data/nsca-2.10.0/src/nsca.c:1486:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result=read(fd,pbuf,(sizeof pbuf)-1); data/nsca-2.10.0/src/nsca.c:1510:17: [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(fd,pbuf,strlen(pbuf)); data/nsca-2.10.0/src/nsca.c:1552:32: [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(strspn(user,"0123456789")<strlen(user)){ data/nsca-2.10.0/src/nsca.c:1581: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). if(strspn(group,"0123456789")<strlen(group)){ data/nsca-2.10.0/src/send_nsca.c:227:19: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(stdin)) >= 0) { data/nsca-2.10.0/src/send_nsca.c:274:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(host_name,ptr1,sizeof(host_name)-1); data/nsca-2.10.0/src/send_nsca.c:277:4: [1] (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 character. strcpy(svc_description,""); data/nsca-2.10.0/src/send_nsca.c:279:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(plugin_output,ptr3,plugin_output_length-1); data/nsca-2.10.0/src/send_nsca.c:282:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(svc_description,ptr2,sizeof(svc_description)-1); data/nsca-2.10.0/src/send_nsca.c:284:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(plugin_output,ptr4,plugin_output_length-1); data/nsca-2.10.0/src/send_nsca.c:427:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(server_name,argv[1],sizeof(server_name)-1); data/nsca-2.10.0/src/send_nsca.c:455:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(server_name,argv[x],sizeof(server_name)); data/nsca-2.10.0/src/send_nsca.c:600: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(varvalue)>sizeof(password)-1){ data/nsca-2.10.0/src/send_nsca.c:606:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(password,varvalue,sizeof(password)); data/nsca-2.10.0/src/utils.c:233:24: [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(CI->keysize<strlen(password)) data/nsca-2.10.0/src/utils.c:234:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(CI->key,password,CI->keysize); data/nsca-2.10.0/src/utils.c:236:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(CI->key,password,strlen(password)); data/nsca-2.10.0/src/utils.c:236: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). strncpy(CI->key,password,strlen(password)); data/nsca-2.10.0/src/utils.c:287:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). seed=fgetc(fp); data/nsca-2.10.0/src/utils.c:337: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). password_length=strlen(password); data/nsca-2.10.0/src/utils.c:418:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). seed=fgetc(fp); data/nsca-2.10.0/src/utils.c:440:8: [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). for(x=strlen(buffer);x>=1;x--){ ANALYSIS SUMMARY: Hits = 109 Lines analyzed = 3466 in approximately 0.12 seconds (29267 lines/second) Physical Source Lines of Code (SLOC) = 2216 Hits@level = [0] 205 [1] 41 [2] 62 [3] 3 [4] 3 [5] 0 Hits@level+ = [0+] 314 [1+] 109 [2+] 68 [3+] 6 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 141.697 [1+] 49.1877 [2+] 30.6859 [3+] 2.70758 [4+] 1.35379 [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.