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/microcom-2019.01.0/microcom.h Examining data/microcom-2019.01.0/commands.c Examining data/microcom-2019.01.0/commands_fsl_imx.c Examining data/microcom-2019.01.0/microcom.c Examining data/microcom-2019.01.0/mux.c Examining data/microcom-2019.01.0/parser.c Examining data/microcom-2019.01.0/serial.c Examining data/microcom-2019.01.0/telnet.c Examining data/microcom-2019.01.0/can.c FINAL RESULTS: data/microcom-2019.01.0/can.c:181:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(ifr.ifr_name, interface); data/microcom-2019.01.0/microcom.h:125:48: [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 dbg_printf(fmt,args...) ({ if (debug) printf(fmt ,##args); }) data/microcom-2019.01.0/mux.c:232:9: [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. size = vsnprintf(buf, sizeof(buf), format, args); data/microcom-2019.01.0/microcom.c:228:16: [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 ((opt = getopt_long(argc, argv, "hp:s:t:c:dfl:oi:a:v", long_options, NULL)) != -1) { data/microcom-2019.01.0/can.c:53: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(to_can.data, buf, loopcount); data/microcom-2019.01.0/can.c:86: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(buf, from_can.data, from_can.can_dlc); data/microcom-2019.01.0/commands_fsl_imx.c:195: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 linebuf[DISP_LINE_LEN]; data/microcom-2019.01.0/commands_fsl_imx.c:387: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). upfd = open(name, O_RDONLY); data/microcom-2019.01.0/commands_fsl_imx.c:508:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[15]; data/microcom-2019.01.0/commands_fsl_imx.c:524:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[15]; data/microcom-2019.01.0/commands_fsl_imx.c:537:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[15]; data/microcom-2019.01.0/commands_fsl_imx.c:555:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[15]; data/microcom-2019.01.0/microcom.c:44: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(&sts, &sots, sizeof (sots)); /* to be used upon exit */ data/microcom-2019.01.0/mux.c:225: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[20]; data/microcom-2019.01.0/mux.c:415: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(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); data/microcom-2019.01.0/mux.c:434:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[BUFSIZE]; data/microcom-2019.01.0/parser.c:118: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 *argv[MAXARGS + 1]; data/microcom-2019.01.0/parser.c:192: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(script, O_RDONLY); data/microcom-2019.01.0/serial.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). fd = open(lockfile, O_RDONLY); data/microcom-2019.01.0/serial.c:205: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(lockfile, O_RDWR | O_CREAT, 0444); data/microcom-2019.01.0/serial.c:219: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(device, O_RDWR | O_NONBLOCK); data/microcom-2019.01.0/telnet.c:99: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 connected_host[256], connected_port[30]; data/microcom-2019.01.0/can.c:78:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(ios->fd, &from_can, sizeof(from_can)); data/microcom-2019.01.0/commands.c:111: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 (!strncmp(argv[1], "1", strlen(argv[1]))) { data/microcom-2019.01.0/commands.c:113:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). } else if (!strncmp(argv[1], "0", strlen(argv[1]))) { data/microcom-2019.01.0/commands_fsl_imx.c:46:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(ios->fd, &r, 1); data/microcom-2019.01.0/commands_fsl_imx.c:69:4: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); data/microcom-2019.01.0/commands_fsl_imx.c:126:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); data/microcom-2019.01.0/commands_fsl_imx.c:139:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf8, 1); data/microcom-2019.01.0/commands_fsl_imx.c:146:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &temp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:150:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &temp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:158:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &temp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:162:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &temp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:166:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &temp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:170:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &temp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:312:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(ios->fd, &r, 1); data/microcom-2019.01.0/commands_fsl_imx.c:433:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(upfd, &tmp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:514:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(ios->fd, &buf[i], 1); data/microcom-2019.01.0/commands_fsl_imx.c:529:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(ios->fd, &buf[i], 1); data/microcom-2019.01.0/commands_fsl_imx.c:542:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(ios->fd, &buf[i], 1); data/microcom-2019.01.0/commands_fsl_imx.c:562:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(ios->fd, &buf[i], 1); data/microcom-2019.01.0/commands_fsl_imx.c:583:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(ios->fd, &tmp, 1); data/microcom-2019.01.0/commands_fsl_imx.c:595:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(ios->fd, &cmd, 1); data/microcom-2019.01.0/microcom.h:43:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t (*read)(struct ios_ops *, void *buf, size_t count); data/microcom-2019.01.0/mux.c:346: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). ios->write(ios, answerback, strlen(answerback)); data/microcom-2019.01.0/mux.c:448:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = ios->read(ios, buf, BUFSIZE); data/microcom-2019.01.0/mux.c:468:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). i = read(STDIN_FILENO, buf, BUFSIZE); data/microcom-2019.01.0/parser.c:129: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(cmd)) data/microcom-2019.01.0/parser.c:135: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(cmd); data/microcom-2019.01.0/serial.c:58:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read(ios->fd, buf, count); data/microcom-2019.01.0/telnet.c:36:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read(ios->fd, buf, count); ANALYSIS SUMMARY: Hits = 51 Lines analyzed = 2741 in approximately 0.10 seconds (28822 lines/second) Physical Source Lines of Code (SLOC) = 2101 Hits@level = [0] 85 [1] 29 [2] 18 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 136 [1+] 51 [2+] 22 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 64.7311 [1+] 24.2742 [2+] 10.4712 [3+] 1.90386 [4+] 1.42789 [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.