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/nbd-3.20/netdb-compat.h Examining data/nbd-3.20/backend.h Examining data/nbd-3.20/nbd.h Examining data/nbd-3.20/nbd-netlink.h Examining data/nbd-3.20/crypto-gnutls.h Examining data/nbd-3.20/nbd-server.c Examining data/nbd-3.20/nbd-debug.h Examining data/nbd-3.20/cliserv.c Examining data/nbd-3.20/nbd-trdump.c Examining data/nbd-3.20/nbd-client.c Examining data/nbd-3.20/gznbd/gznbd.c Examining data/nbd-3.20/buffer.c Examining data/nbd-3.20/tests/code/trim.c Examining data/nbd-3.20/tests/code/mask.c Examining data/nbd-3.20/tests/code/punchdummy.c Examining data/nbd-3.20/tests/code/clientacl.c Examining data/nbd-3.20/tests/code/macro.h Examining data/nbd-3.20/tests/code/size.c Examining data/nbd-3.20/tests/code/dup.c Examining data/nbd-3.20/tests/run/nbd-tester-client.c Examining data/nbd-3.20/treefiles.h Examining data/nbd-3.20/nbdsrv.c Examining data/nbd-3.20/make-integrityhuge.c Examining data/nbd-3.20/cliserv.h Examining data/nbd-3.20/treefiles.c Examining data/nbd-3.20/lfs.h Examining data/nbd-3.20/nbdsrv.h Examining data/nbd-3.20/crypto-gnutls.c Examining data/nbd-3.20/buffer.h Examining data/nbd-3.20/coverity_model.c FINAL RESULTS: data/nbd-3.20/crypto-gnutls.c:86:10: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. return vfprintf (stderr, format, ap); data/nbd-3.20/nbd-client.c:893:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, tmp, ap); data/nbd-3.20/nbd-debug.h:6:20: [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. #define DEBUG(...) printf(__VA_ARGS__) data/nbd-3.20/nbd-server.c:434:10: [4] (shell) system: 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. retval=system(cmd); data/nbd-3.20/nbdsrv.c:39: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(privmask, mask); data/nbd-3.20/nbdsrv.h:133: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. #define msg(prio, ...) syslog(prio, __VA_ARGS__) data/nbd-3.20/tests/run/nbd-tester-client.c:353:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. return vfprintf(stderr, format, ap); data/nbd-3.20/tests/run/nbd-tester-client.c:356:91: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define READ_ALL_ERRCHK(f, buf, len, whereto, errmsg...) if((read_all(f, buf, len))<=0) { snprintf(errstr, errstr_len, ##errmsg); goto whereto; } data/nbd-3.20/tests/run/nbd-tester-client.c:357:97: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define READ_ALL_ERR_RT(f, buf, len, whereto, rval, errmsg...) if((read_all(f, buf, len))<=0) { snprintf(errstr, errstr_len, ##errmsg); retval = rval; goto whereto; } data/nbd-3.20/tests/run/nbd-tester-client.c:359:93: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define WRITE_ALL_ERRCHK(f, buf, len, whereto, errmsg...) if((write_all(f, buf, len))<=0) { snprintf(errstr, errstr_len, ##errmsg); goto whereto; } data/nbd-3.20/tests/run/nbd-tester-client.c:360:99: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define WRITE_ALL_ERR_RT(f, buf, len, whereto, rval, errmsg...) if((write_all(f, buf, len))<=0) { snprintf(errstr, errstr_len, ##errmsg); retval = rval; goto whereto; } data/nbd-3.20/tests/run/nbd-tester-client.c:654:3: [4] (shell) execvp: 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. execvp(argv[0], argv); data/nbd-3.20/treefiles.c:26:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(name,lenmax,"/FILE%04" PRIX64,(pos/TREEPAGESIZE) % TREEDIRSIZE); data/nbd-3.20/treefiles.c:39: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(filename,name); data/nbd-3.20/treefiles.c:64: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(filename,name); data/nbd-3.20/make-integrityhuge.c:39:8: [3] (random) random: 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. r ^= random() ^ (r << 15); data/nbd-3.20/nbd-server.c:570:11: [3] (buffer) getopt_long: 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((c=getopt_long(argc, argv, "-C:cwdl:mo:rp:M:V", long_options, &i))>=0) { data/nbd-3.20/tests/run/nbd-tester-client.c:926: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. char *print = getenv("NBD_TEST_SILENT"); data/nbd-3.20/tests/run/nbd-tester-client.c:1172:14: [3] (random) random: 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. handle ^= random() ^ (handle << 15); data/nbd-3.20/tests/run/nbd-tester-client.c:1198:19: [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. char *do_print = getenv("NBD_TEST_SILENT"); data/nbd-3.20/tests/run/nbd-tester-client.c:1230:51: [3] (tmpfile) tmpnam: Temporary file race condition (CWE-377). if (-1 == (blkhashfd = open(blkhashname = strdup(tmpnam(NULL)), data/nbd-3.20/tests/run/nbd-tester-client.c:1756:14: [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 ((c = getopt(argc, argv, "FN:t:owfilu:hC:K:A:H:I")) >= 0) { data/nbd-3.20/cliserv.c:50: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 s1[150], *s2; data/nbd-3.20/gznbd/gznbd.c:74: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 chunk[CHUNK]; data/nbd-3.20/gznbd/gznbd.c:101:5: [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[BLOCK]; data/nbd-3.20/gznbd/gznbd.c:149: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). nbd=open(argv[1], O_RDWR); data/nbd-3.20/gznbd/gznbd.c:233: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(chunk,&reply,sizeof(struct nbd_reply)); data/nbd-3.20/nbd-client.c:187: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[256]; data/nbd-3.20/nbd-client.c:200: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(buf, O_RDONLY))<0) { data/nbd-3.20/nbd-client.c:368: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[BUF_SIZE]; data/nbd-3.20/nbd-client.c:450: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(size, buf, sizeof(*size)); data/nbd-3.20/nbd-client.c:453: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(flags, buf, sizeof(*flags)); data/nbd-3.20/nbd-client.c:467: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 b[sizeof(*flags) + sizeof(*rsize64)]; data/nbd-3.20/nbd-client.c:473: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 buf[125]; data/nbd-3.20/nbd-client.c:482: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[256] = "\0\0\0\0\0\0\0\0\0"; data/nbd-3.20/nbd-client.c:633:7: [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 errstr[1024]; data/nbd-3.20/nbd-client.c:643:7: [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 errstr[1024]; data/nbd-3.20/nbd-client.c:656: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(&info_type, rep->data, 2); data/nbd-3.20/nbd-client.c:677: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). int fd = open(SYSCONFDIR "/nbdtab", O_RDONLY); data/nbd-3.20/nbd-client.c:878:7: [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(file, O_WRONLY); data/nbd-3.20/nbd-client.c:889: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 tmp[256]; data/nbd-3.20/nbd-client.c:922:12: [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). int nbd = open(device, O_RDWR); data/nbd-3.20/nbd-client.c:1189: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). nbd = open(nbddev, O_RDWR); data/nbd-3.20/nbd-client.c:1289:7: [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(open(nbddev, O_RDONLY) < 0) { data/nbd-3.20/nbd-client.c:1319:12: [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). nbd = open(nbddev, O_RDWR); data/nbd-3.20/nbd-server.c:181: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 pidfname[256]; /**< name of our PID file */ data/nbd-3.20/nbd-server.c:402: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[1024]; data/nbd-3.20/nbd-server.c:855: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(&genconftmp, genconf, sizeof(struct generic_conf)); data/nbd-3.20/nbd-server.c:1043: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(genconf, &genconftmp, sizeof(struct generic_conf)); data/nbd-3.20/nbd-server.c:1435: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 pagebuf[DIFFPAGESIZE]; data/nbd-3.20/nbd-server.c:1475:4: [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(pagebuf+offset,buf,wrlen) ; data/nbd-3.20/nbd-server.c:1640: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 peername[NI_MAXHOST]; data/nbd-3.20/nbd-server.c:1641: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 netname[NI_MAXHOST]; data/nbd-3.20/nbd-server.c:1653: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(peername, "unix"); data/nbd-3.20/nbd-server.c:1698:4: [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(&netaddr, &(client->clientaddr), addrinlen); data/nbd-3.20/nbd-server.c:1791: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). fi.fhandle = open(client->server->exportname, mode); data/nbd-3.20/nbd-server.c:1862:18: [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). fi.fhandle = mkstemp(tmpname); data/nbd-3.20/nbd-server.c:1870: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). fi.fhandle = open(tmpname, mode, 0600); data/nbd-3.20/nbd-server.c:1873: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). fi.fhandle = open(tmpname, O_RDONLY); data/nbd-3.20/nbd-server.c:1962: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). client->difffile=open(client->difffilename,O_RDWR | O_CREAT | O_TRUNC,0600) ; data/nbd-3.20/nbd-server.c:1996: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 zeros[128]; data/nbd-3.20/nbd-server.c:2067:6: [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(client->server->transactionlog, data/nbd-3.20/nbd-server.c:2142: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[1024]; data/nbd-3.20/nbd-server.c:2162: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(buf, &len, sizeof(len)); data/nbd-3.20/nbd-server.c:2219: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 buf[1024*1024]; data/nbd-3.20/nbd-server.c:2283: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[1024]; data/nbd-3.20/nbd-server.c:2545: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(&(rep->handle), &(req->handle), sizeof(req->handle)); data/nbd-3.20/nbd-server.c:3167: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(&rset, &mset, sizeof(fd_set)); data/nbd-3.20/nbd-server.c:3460: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). pidf=fopen(pidfname, "w"); data/nbd-3.20/nbd.h:75: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 handle[8]; data/nbd-3.20/nbd.h:87: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 handle[8]; /* handle you got from request */ data/nbd-3.20/nbdsrv.c:35: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 privmask[strlen(mask)+1]; data/nbd-3.20/nbdsrv.c:115:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[LINELEN]; data/nbd-3.20/nbdsrv.c:122:9: [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(opts->server->authname,"r"))==NULL) { data/nbd-3.20/tests/code/clientacl.c:16: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[1024]; data/nbd-3.20/tests/code/size.c:8:11: [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). int fd = mkstemp(filename); data/nbd-3.20/tests/run/nbd-tester-client.c:76: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 orighandle[8]; data/nbd-3.20/tests/run/nbd-tester-client.c:215:4: [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(l->tail->writeptr, data, towrite); data/nbd-3.20/tests/run/nbd-tester-client.c:365: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[256]; data/nbd-3.20/tests/run/nbd-tester-client.c:649:10: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. child = vfork(); data/nbd-3.20/tests/run/nbd-tester-client.c:683: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(&(req.handle), &(counter), sizeof(counter)); data/nbd-3.20/tests/run/nbd-tester-client.c:712: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[datasize]; data/nbd-3.20/tests/run/nbd-tester-client.c:755: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[((1024 * 1024) + sizeof(struct nbd_request) / 2) << 1]; data/nbd-3.20/tests/run/nbd-tester-client.c:770: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(&(req.handle), &i, sizeof(i)); data/nbd-3.20/tests/run/nbd-tester-client.c:883: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 buf[1024]; data/nbd-3.20/tests/run/nbd-tester-client.c:912: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 writebuf[1024]; data/nbd-3.20/tests/run/nbd-tester-client.c:921: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 speedchar[2] = { '\0', '\0' }; data/nbd-3.20/tests/run/nbd-tester-client.c:974:4: [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(&(req.handle), &i, sizeof(i)); data/nbd-3.20/tests/run/nbd-tester-client.c:990: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(&(req.handle), &j, sizeof(j)); data/nbd-3.20/tests/run/nbd-tester-client.c:1187: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 speedchar[2] = { '\0', '\0' }; data/nbd-3.20/tests/run/nbd-tester-client.c:1224:42: [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). if (!blkhashname || (-1 == (blkhashfd = mkstemp(blkhashname)))) { data/nbd-3.20/tests/run/nbd-tester-client.c:1230:25: [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 (-1 == (blkhashfd = open(blkhashname = strdup(tmpnam(NULL)), data/nbd-3.20/tests/run/nbd-tester-client.c:1263:21: [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 (-1 == (logfd = open(transactionlog, O_RDONLY))) { data/nbd-3.20/tests/run/nbd-tester-client.c:1337: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(prc->orighandle, prc->req.handle, 8); data/nbd-3.20/tests/run/nbd-tester-client.c:1453:7: [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 dbuf[512]; data/nbd-3.20/tests/run/nbd-tester-client.c:1541:4: [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(&handle, rep.handle, 8); data/nbd-3.20/tests/run/nbd-tester-client.c:1575:6: [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 dbuf[512]; data/nbd-3.20/treefiles.c:30: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[10]; data/nbd-3.20/treefiles.c:32: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(name,buffer,9); // copy into string without trailing zero data/nbd-3.20/treefiles.c:38: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 filename[256+strlen(name)]; data/nbd-3.20/treefiles.c:63: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 filename[256+strlen(name)]; data/nbd-3.20/treefiles.c:71: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). int handle=open(filename, mode, 0600); data/nbd-3.20/treefiles.c:78: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). handle=open(filename, O_RDWR|O_CREAT, 0600); data/nbd-3.20/treefiles.c:88:13: [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). handle = mkstemp(tmpname); data/nbd-3.20/cliserv.c:52:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s1, s, sizeof(s1)); data/nbd-3.20/cliserv.c:54:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s1 + (s2 - s), strerror(errno), sizeof(s1) - (s2 - s)); data/nbd-3.20/cliserv.c:56:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1)); data/nbd-3.20/cliserv.c:56: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). strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1)); data/nbd-3.20/cliserv.c:56: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). strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1)); data/nbd-3.20/cliserv.c:61:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s1 + (s2 - s), hstrerror(h_errno), sizeof(s1) - (s2 - s)); data/nbd-3.20/cliserv.c:63:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1)); data/nbd-3.20/cliserv.c:63: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). strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1)); data/nbd-3.20/cliserv.c:63: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). strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1)); data/nbd-3.20/cliserv.c:117:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). res = read(f, buf, len); data/nbd-3.20/crypto-gnutls.c:480:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read (plainfd, addr, (size_t) len); data/nbd-3.20/gznbd/gznbd.c:189:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sk,&request,sizeof(request))!=sizeof(request)){ data/nbd-3.20/nbd-client.c:207:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len=read(fd, buf, 256); data/nbd-3.20/nbd-client.c:286:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(un_addr.sun_path, path, sizeof(un_addr.sun_path) - 1); data/nbd-3.20/nbd-client.c:312:14: [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). datasize = strlen((char*)data); data/nbd-3.20/nbd-client.c:323: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). uint32_t nlen = htonl(strlen(name)); data/nbd-3.20/nbd-client.c:325: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). send_request(sock, opt, sizeof(uint32_t) + strlen(name) + sizeof(uint16_t) + n_reqs * sizeof(uint16_t), NULL); data/nbd-3.20/nbd-client.c:327:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). writeit(sock, name, strlen(name)); data/nbd-3.20/nbd-client.c:375:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sock, &magic, sizeof(magic)) < 0) { data/nbd-3.20/nbd-client.c:378:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sock, &opt_server, sizeof(opt_server)) < 0) { data/nbd-3.20/nbd-client.c:381:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sock, &reptype, sizeof(reptype)) <0) { data/nbd-3.20/nbd-client.c:384:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sock, &len, sizeof(len)) < 0) { data/nbd-3.20/nbd-client.c:403:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if((rlen=read(sock, buf, len)) < 0) { data/nbd-3.20/nbd-client.c:416:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sock, &lenn, sizeof(lenn)) < 0) { data/nbd-3.20/nbd-client.c:425:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sock, buf, lenn) < 0) { data/nbd-3.20/nbd-client.c:434:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(sock, buf, len) < 0) { data/nbd-3.20/nbd-client.c:526:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(sock, &tmp64, sizeof(tmp64)) < 0) data/nbd-3.20/nbd-client.c:532:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(sock, &tmp32, sizeof(tmp32)) < 0) data/nbd-3.20/nbd-client.c:537:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(sock, &tmp32, sizeof(tmp32)) < 0) data/nbd-3.20/nbd-client.c:543:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(sock, &tmp32, sizeof(tmp32)) < 0) err( data/nbd-3.20/nbd-client.c:703:13: [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). size_t l = strlen(cfgname) + 6; data/nbd-3.20/nbd-client.c:881: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). len = strlen(value); data/nbd-3.20/nbd-client.c:1184:5: [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(name)==0 && !(opts & NBDC_DO_LIST)) { data/nbd-3.20/nbd-server.c:607: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). last=strlen(optarg)-1; data/nbd-3.20/nbd-server.c:635:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(pidfname, optarg, 256); data/nbd-3.20/nbd-server.c:729: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). if(strcmp((de->d_name + strlen(de->d_name) - 5), ".conf")) { data/nbd-3.20/nbd-server.c:958: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). if(strlen(virtstyle)<10) { data/nbd-3.20/nbd-server.c:1613:14: [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). datasize = strlen((char*)data); data/nbd-3.20/nbd-server.c:1677: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). memmove(peername, peername+7, strlen(peername)); data/nbd-3.20/nbd-server.c:1687:14: [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(i=0;i<strlen(peername);i++) { data/nbd-3.20/nbd-server.c:2037:9: [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). len = strlen(client->server->servename); data/nbd-3.20/nbd-server.c:2161:15: [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). len = htonl(strlen(serve->servename)); data/nbd-3.20/nbd-server.c:2163:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ptr, serve->servename, sizeof(buf) - sizeof(len)); data/nbd-3.20/nbd-server.c:2164: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). send_reply(client, opt, NBD_REP_SERVER, strlen(serve->servename)+sizeof(len), buf); data/nbd-3.20/nbd-server.c:2969:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch((r = read(socket, &len, sizeof len))) { data/nbd-3.20/nbd-server.c:3250:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sa.sun_path, sockname, sizeof sa.sun_path); data/nbd-3.20/nbd-server.c:3296:14: [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(!addr || strlen(addr) == 0) { data/nbd-3.20/nbd-server.c:3458: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(pidfname, "/var/run/nbd-server.pid", 255); data/nbd-3.20/nbd-trdump.c:25:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if((res=read(f, buf, len)) <=0) { data/nbd-3.20/nbdsrv.c:35: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). char privmask[strlen(mask)+1]; data/nbd-3.20/tests/run/nbd-tester-client.c:318:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((res = read(f, buf, len)) <= 0) { data/nbd-3.20/tests/run/nbd-tester-client.c:374: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). READ_ALL_ERRCHK(sock, buf, strlen(INIT_PASSWD), err, data/nbd-3.20/tests/run/nbd-tester-client.c:376:6: [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). buf[strlen(INIT_PASSWD)] = 0; data/nbd-3.20/tests/run/nbd-tester-client.c:377:6: [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(buf) == 0) { data/nbd-3.20/tests/run/nbd-tester-client.c:381: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 (strncmp(buf, INIT_PASSWD, strlen(INIT_PASSWD))) { data/nbd-3.20/tests/run/nbd-tester-client.c:391: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(errstr, "mymagic does not match", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:426:4: [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(errstr, "server does not support handshake", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:455:4: [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(errstr, "reply magic does not match", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:462:4: [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(errstr, "Reply to wrong option", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:480:4: [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(errstr, "Option reply data length != 0", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:500:4: [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(errstr, "Cannot establish TLS session", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:505:4: [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(errstr, "Cannot get socket pair", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:514:4: [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(errstr, "Cannot set socket options", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:536: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(errstr, "TLS requested but support not compiled in", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:554: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). tmp32 = htonl((uint32_t) strlen(name)); data/nbd-3.20/tests/run/nbd-tester-client.c:557:31: [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_ALL_ERRCHK(sock, name, strlen(name), err, data/nbd-3.20/tests/run/nbd-tester-client.c:584:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errstr, strerror(errno), errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:591:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(addr.sun_path, unixsock, sizeof addr.sun_path); data/nbd-3.20/tests/run/nbd-tester-client.c:594:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errstr, strerror(errno), errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:614:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errstr, strerror(errno), errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:619:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errstr, hstrerror(h_errno), errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:627:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errstr, strerror(errno), errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:645:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errstr, strerror(errno), errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:660:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errstr, strerror(errno), errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:862: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(errstr, "magic does not match", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:869: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(errstr, "option does not match", errstr_len); data/nbd-3.20/tests/run/nbd-tester-client.c:876: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(errstr, "status does not match", errstr_len); data/nbd-3.20/treefiles.c:38:20: [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). char filename[256+strlen(name)]; data/nbd-3.20/treefiles.c:41:26: [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). construct_path(filename+strlen(name),256,size,pos,&ppos); data/nbd-3.20/treefiles.c:63:20: [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). char filename[256+strlen(name)]; data/nbd-3.20/treefiles.c:66:26: [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). construct_path(filename+strlen(name),256,size,pos,&ppos); data/nbd-3.20/treefiles.c:87:21: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t oldmode = umask(77); data/nbd-3.20/treefiles.c:89:4: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(oldmode); ANALYSIS SUMMARY: Hits = 187 Lines analyzed = 9634 in approximately 0.27 seconds (35699 lines/second) Physical Source Lines of Code (SLOC) = 7494 Hits@level = [0] 182 [1] 83 [2] 82 [3] 7 [4] 15 [5] 0 Hits@level+ = [0+] 369 [1+] 187 [2+] 104 [3+] 22 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 49.2394 [1+] 24.9533 [2+] 13.8778 [3+] 2.93568 [4+] 2.0016 [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.