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/mbuffer-20200929+ds2/common.c Examining data/mbuffer-20200929+ds2/common.h Examining data/mbuffer-20200929+ds2/dest.h Examining data/mbuffer-20200929+ds2/globals.h Examining data/mbuffer-20200929+ds2/hashing.h Examining data/mbuffer-20200929+ds2/have-af.c Examining data/mbuffer-20200929+ds2/idev.c Examining data/mbuffer-20200929+ds2/input.c Examining data/mbuffer-20200929+ds2/input.h Examining data/mbuffer-20200929+ds2/lf_names.c Examining data/mbuffer-20200929+ds2/log.h Examining data/mbuffer-20200929+ds2/network.h Examining data/mbuffer-20200929+ds2/settings.h Examining data/mbuffer-20200929+ds2/log.c Examining data/mbuffer-20200929+ds2/globals.c Examining data/mbuffer-20200929+ds2/mbconf.h Examining data/mbuffer-20200929+ds2/network.c Examining data/mbuffer-20200929+ds2/settings.c Examining data/mbuffer-20200929+ds2/tapetest.c Examining data/mbuffer-20200929+ds2/hashing.c Examining data/mbuffer-20200929+ds2/mbuffer.c FINAL RESULTS: data/mbuffer-20200929+ds2/input.c:151: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. ret = system(cmd); data/mbuffer-20200929+ds2/log.c:131:7: [4] (format) vsnprintf: 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. b += vsnprintf(buf + b,sizeof(buf)-b,msg,val); data/mbuffer-20200929+ds2/log.c:148:8: [4] (format) vsnprintf: 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. b += vsnprintf(b,sizeof(buf)-(b-buf),msg,val); data/mbuffer-20200929+ds2/log.c:166:8: [4] (format) vsnprintf: 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. b += vsnprintf(b,sizeof(buf)-(b-buf),msg,val); data/mbuffer-20200929+ds2/log.c:186:8: [4] (format) vsnprintf: 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. b += vsnprintf(b,sizeof(buf)-(b-buf),msg,val); data/mbuffer-20200929+ds2/log.c:207:8: [4] (format) vsnprintf: 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. b += vsnprintf(b,sizeof(buf)-(b-buf),msg,val); data/mbuffer-20200929+ds2/log.c:231:8: [4] (format) vsnprintf: 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. b += vsnprintf(b,sizeof(buf)-(b-buf),msg,val); data/mbuffer-20200929+ds2/log.c:249:7: [4] (format) vsnprintf: 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. b += vsnprintf(b,sizeof(buf)-(b-buf),msg,val); data/mbuffer-20200929+ds2/mbuffer.c:98:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. return sprintf(s,f,v,*dim); data/mbuffer-20200929+ds2/mbuffer.c:535:12: [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. (void) snprintf(cmd_buf, sizeof(cmd_buf), default_cmd, Infile); data/mbuffer-20200929+ds2/mbuffer.c:539: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. err = system(cmd); data/mbuffer-20200929+ds2/tapetest.c:93:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(newpath, "%s.%06d", path, ++opencount); data/mbuffer-20200929+ds2/idev.c:58: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. const char *d = getenv("IDEV_DEBUG"); data/mbuffer-20200929+ds2/idev.c:64:22: [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. const char *idev = getenv("IDEV"); data/mbuffer-20200929+ds2/idev.c:80: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. if (strcmp(path, getenv("IDEV")) == 0) { data/mbuffer-20200929+ds2/idev.c:93: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. const char *d = getenv("IDEV_DEBUG"); data/mbuffer-20200929+ds2/idev.c:105: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. BSize = strtol(getenv("BSIZE"),0,0); data/mbuffer-20200929+ds2/idev.c:124: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. const char *d = getenv("IDEV_DEBUG"); data/mbuffer-20200929+ds2/idev.c:137: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. BSize = strtol(getenv("BSIZE"),0,0); data/mbuffer-20200929+ds2/idev.c:153: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. const char *d = getenv("IDEV_DEBUG"); data/mbuffer-20200929+ds2/idev.c:166: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. BSize = strtol(getenv("BSIZE"),0,0); data/mbuffer-20200929+ds2/mbuffer.c:1041:21: [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. const char *home = getenv("HOME"); data/mbuffer-20200929+ds2/settings.c:463: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 *tmpdir = getenv("TMPDIR") ? getenv("TMPDIR") : "/var/tmp"; data/mbuffer-20200929+ds2/settings.c:463:38: [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 *tmpdir = getenv("TMPDIR") ? getenv("TMPDIR") : "/var/tmp"; data/mbuffer-20200929+ds2/common.c:180: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 output[16]; data/mbuffer-20200929+ds2/hashing.c:316: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. unsigned char hashvalue[128]; data/mbuffer-20200929+ds2/hashing.c:327: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(hashvalue,gcry_md_read(hd,dest->mode),ds); data/mbuffer-20200929+ds2/hashing.c:364: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(msg,an,al); data/mbuffer-20200929+ds2/hashing.c:365: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(msg+al," hash: ",7); data/mbuffer-20200929+ds2/hashing.c:368:10: [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. m += sprintf(m,"%02x",(unsigned int)hashvalue[i]); data/mbuffer-20200929+ds2/input.c: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 cmd_buf[15+strlen(Infile)]; data/mbuffer-20200929+ds2/input.c:168: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). In = open(Infile, O_RDONLY | O_LARGEFILE); data/mbuffer-20200929+ds2/input.c:170: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). In = open(Infile,O_RDONLY); data/mbuffer-20200929+ds2/input.c:193: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). In = open(Infile,flags); data/mbuffer-20200929+ds2/input.c:196: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). In = open(Infile,flags); data/mbuffer-20200929+ds2/input.c:225: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(Buffer[at]+num,DevBuf+Off,s); data/mbuffer-20200929+ds2/lf_names.c:8:2: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). open(*argv,O_RDONLY); data/mbuffer-20200929+ds2/log.c: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 buf[256]; data/mbuffer-20200929+ds2/log.c:130: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. (void) memcpy(buf,Prefix,b); data/mbuffer-20200929+ds2/log.c:143: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[256], *b = buf + PrefixLen; data/mbuffer-20200929+ds2/log.c:147:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(buf,Prefix,PrefixLen); data/mbuffer-20200929+ds2/log.c:161: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[256], *b = buf + PrefixLen; data/mbuffer-20200929+ds2/log.c:165:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(buf,Prefix,PrefixLen); data/mbuffer-20200929+ds2/log.c:179: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[256], *b = buf + PrefixLen; data/mbuffer-20200929+ds2/log.c:183:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(buf,Prefix,PrefixLen); data/mbuffer-20200929+ds2/log.c:184:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(b,"warning: ",9); data/mbuffer-20200929+ds2/log.c:200: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[256], *b = buf + PrefixLen; data/mbuffer-20200929+ds2/log.c:204:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(buf,Prefix,PrefixLen); data/mbuffer-20200929+ds2/log.c:205:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(b,"error: ",7); data/mbuffer-20200929+ds2/log.c:224: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[256], *b = buf + PrefixLen; data/mbuffer-20200929+ds2/log.c:228:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(buf,Prefix,PrefixLen); data/mbuffer-20200929+ds2/log.c:229:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(b,"fatal: ",7); data/mbuffer-20200929+ds2/log.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 buf[256], *b = buf + PrefixLen; data/mbuffer-20200929+ds2/log.c:248: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. (void) memcpy(buf,Prefix,PrefixLen); data/mbuffer-20200929+ds2/mbuffer.c:106: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], *msg = buf; data/mbuffer-20200929+ds2/mbuffer.c:134:10: [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. msg += sprintf(msg,"summary: %dx ",numthreads); data/mbuffer-20200929+ds2/mbuffer.c:136:10: [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. msg += sprintf(msg,"summary: "); data/mbuffer-20200929+ds2/mbuffer.c:138:9: [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. msg += sprintf(msg,"Byte in "); data/mbuffer-20200929+ds2/mbuffer.c:140:10: [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. msg += sprintf(msg,"%dh %02dmin %04.1fsec - average of ",h,m,secs); data/mbuffer-20200929+ds2/mbuffer.c:142:10: [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. msg += sprintf(msg,"%2dmin %04.1fsec - average of ",m,secs); data/mbuffer-20200929+ds2/mbuffer.c:144:10: [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. msg += sprintf(msg,"%4.1fsec - average of ",secs); data/mbuffer-20200929+ds2/mbuffer.c:146:9: [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. msg += sprintf(msg,"B/s"); data/mbuffer-20200929+ds2/mbuffer.c:148:10: [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. msg += sprintf(msg,", %dx empty",EmptyCount); data/mbuffer-20200929+ds2/mbuffer.c:150:10: [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. msg += sprintf(msg,", %dx full",FullCount); data/mbuffer-20200929+ds2/mbuffer.c:259: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[256], *b = buf; data/mbuffer-20200929+ds2/mbuffer.c:294:8: [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. b += sprintf(b,"\rin @ "); data/mbuffer-20200929+ds2/mbuffer.c:297:8: [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. b += sprintf(b,"B/s, out @ "); data/mbuffer-20200929+ds2/mbuffer.c:300:9: [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. b += sprintf(b,"B/s, %d x ",numsender); data/mbuffer-20200929+ds2/mbuffer.c:302:9: [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. b += sprintf(b,"B/s, "); data/mbuffer-20200929+ds2/mbuffer.c:304:8: [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. b += sprintf(b,"B total, buffer %3.0f%% full",fill); data/mbuffer-20200929+ds2/mbuffer.c:307:9: [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. b += sprintf(b,", %3.0f%% done",done); data/mbuffer-20200929+ds2/mbuffer.c:530:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char cmd_buf[sizeof(default_cmd)+strlen(outfile)]; data/mbuffer-20200929+ds2/mbuffer.c:579: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). out = open(outfile,mode,0666); data/mbuffer-20200929+ds2/mbuffer.c:866: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). d->fd = open(d->arg,d->mode,0666); data/mbuffer-20200929+ds2/mbuffer.c:870: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). d->fd = open(d->arg,d->mode,0666); data/mbuffer-20200929+ds2/mbuffer.c:977: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 pm = open("/proc/meminfo",O_RDONLY); data/mbuffer-20200929+ds2/mbuffer.c:979: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[4096]; data/mbuffer-20200929+ds2/mbuffer.c:1049: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 dfname[PATH_MAX+1]; data/mbuffer-20200929+ds2/mbuffer.c:1054: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(dfname,home,l); data/mbuffer-20200929+ds2/mbuffer.c:1057: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(dfname+l,".mbuffer.rc",12); data/mbuffer-20200929+ds2/mbuffer.c:1201: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(Prefix,progname,PrefixLen); data/mbuffer-20200929+ds2/mbuffer.c:1259: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 tty = open("/dev/tty",O_RDWR); data/mbuffer-20200929+ds2/network.c:99: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(host,addr,l); data/mbuffer-20200929+ds2/network.c:155: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 chost[NI_MAXHOST], serv[NI_MAXSERV]; data/mbuffer-20200929+ds2/network.c:173:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char xhost[NI_MAXHOST]; data/mbuffer-20200929+ds2/network.c:356: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(host,addr,l); data/mbuffer-20200929+ds2/network.c:422:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(&saddr.sin_addr,h->h_addr_list[0],h->h_length); data/mbuffer-20200929+ds2/settings.c:186: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). df = open(cfname,O_RDONLY); data/mbuffer-20200929+ds2/settings.c:219: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 key[64],valuestr[64]; data/mbuffer-20200929+ds2/settings.c:468:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(Tmpfile,tmpdir,tl); data/mbuffer-20200929+ds2/settings.c:470:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy(Tmpfile+tl+1,tmplname,sizeof(tmplname)); data/mbuffer-20200929+ds2/settings.c:474:14: [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 tmp = mkstemp(Tmpfile); data/mbuffer-20200929+ds2/settings.c:487:10: [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). Tmp = open(Tmpfile,mode,0600); data/mbuffer-20200929+ds2/settings.c:873: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). Log = open(argv[c],O_WRONLY|O_APPEND|O_TRUNC|O_CREAT|O_LARGEFILE,0666); data/mbuffer-20200929+ds2/tapetest.c:53: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). #error name of libc open() could not be determined - test cannot be performed data/mbuffer-20200929+ds2/tapetest.c:79: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 newpath[256]; data/mbuffer-20200929+ds2/hashing.c:360: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). al = strlen(an); data/mbuffer-20200929+ds2/input.c:87:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (-1 == read(STDERR_FILENO,&c,1) && (errno != EINTR)) { data/mbuffer-20200929+ds2/input.c:119:18: [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 cmd_buf[15+strlen(Infile)]; data/mbuffer-20200929+ds2/input.c:236:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t in = read(In,Buffer[at] + num,Blocksize - num); data/mbuffer-20200929+ds2/input.c:256:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t i2 = read(In,DevBuf,IDevBSize); data/mbuffer-20200929+ds2/input.c:290:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in = read(In,Buffer[at] + num,Blocksize - num); data/mbuffer-20200929+ds2/lf_names.c:10:2: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(0,&x,sizeof(x)); data/mbuffer-20200929+ds2/mbuffer.c:315:34: [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). nw = write(STDERR_FILENO,buf,strlen(buf)); data/mbuffer-20200929+ds2/mbuffer.c:320:34: [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). nw = write(STDERR_FILENO,buf,strlen(buf)); data/mbuffer-20200929+ds2/mbuffer.c:530:37: [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 cmd_buf[sizeof(default_cmd)+strlen(outfile)]; data/mbuffer-20200929+ds2/mbuffer.c:568:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (-1 == read(STDERR_FILENO,&c,1) && (errno != EINTR)) { data/mbuffer-20200929+ds2/mbuffer.c:938: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). (void) write(STDERR_FILENO,d->result,strlen(d->result)); data/mbuffer-20200929+ds2/mbuffer.c:940: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). (void) write(Log,d->result,strlen(d->result)); data/mbuffer-20200929+ds2/mbuffer.c:980:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int n = read(pm,tmp,sizeof(tmp)); data/mbuffer-20200929+ds2/mbuffer.c:1048: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(home); data/mbuffer-20200929+ds2/mbuffer.c:1199: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). PrefixLen = strlen(progname); data/mbuffer-20200929+ds2/mbuffer.c:1256:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read(STDERR_FILENO,&c,1) != -1) || (errno == EAGAIN)) { data/mbuffer-20200929+ds2/mbuffer.c:1356:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). err = read(TermQ[0],&null,1); data/mbuffer-20200929+ds2/network.c:97: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). l = strlen(addr) + 1; data/mbuffer-20200929+ds2/network.c:354: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). l = strlen(addr) + 1; data/mbuffer-20200929+ds2/settings.c:208:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int n = read(df,cfdata,st.st_size); data/mbuffer-20200929+ds2/settings.c:464: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). size_t tl = strlen(tmpdir); data/mbuffer-20200929+ds2/settings.c:711: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). if (strncmp(opt,argv[*c],strlen(opt))) data/mbuffer-20200929+ds2/settings.c:713: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(argv[*c]) > 2) ANALYSIS SUMMARY: Hits = 120 Lines analyzed = 5061 in approximately 0.18 seconds (28470 lines/second) Physical Source Lines of Code (SLOC) = 4189 Hits@level = [0] 44 [1] 24 [2] 72 [3] 12 [4] 12 [5] 0 Hits@level+ = [0+] 164 [1+] 120 [2+] 96 [3+] 24 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 39.1502 [1+] 28.6465 [2+] 22.9172 [3+] 5.72929 [4+] 2.86465 [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.