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/mbpoll-1.4.11+dfsg/src/custom-rts.c Examining data/mbpoll-1.4.11+dfsg/src/serial.c Examining data/mbpoll-1.4.11+dfsg/src/serial.h Examining data/mbpoll-1.4.11+dfsg/src/mbpoll.c Examining data/mbpoll-1.4.11+dfsg/src/custom-rts.h Examining data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c Examining data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.h Examining data/mbpoll-1.4.11+dfsg/mbpoll-config.h FINAL RESULTS: data/mbpoll-1.4.11+dfsg/src/mbpoll.c:60:25: [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 PDEBUG(fmt,...) printf("%s:%d: %s(): " fmt, BASENAME(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__) data/mbpoll-1.4.11+dfsg/src/mbpoll.c:62:42: [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 PDEBUG(...) if (ctx.bIsVerbose) printf(__VA_ARGS__) data/mbpoll-1.4.11+dfsg/src/mbpoll.c:1235: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, format, va); data/mbpoll-1.4.11+dfsg/src/mbpoll.c:1322:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stream, data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:108:46: [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. d->__posixly_correct = posixly_correct | !!getenv ("POSIXLY_CORRECT"); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.h:122:9: [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. #define getopt getopt_w data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.h:123:9: [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. #define getopt_long getopt_long_w data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.h:128:9: [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. #define getopt getopt_a data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.h:129:9: [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. #define getopt_long getopt_long_a data/mbpoll-1.4.11+dfsg/src/mbpoll.c:418:19: [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. iNextOption = getopt (argc, argv, short_options); data/mbpoll-1.4.11+dfsg/src/mbpoll.c:350:10: [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 fname[_MAX_FNAME]; data/mbpoll-1.4.11+dfsg/src/serial.c:31:10: [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 str[16]; data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:205:39: [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 (namelen == (unsigned int) strlen (p->name)) { data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:236: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). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:257:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:270:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:275: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). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:347:60: [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 ( (unsigned int) (nameend - d->__nextchar) == strlen (p->name)) { data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:365: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). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:379:30: [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). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:391:30: [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). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:398: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). d->__nextchar += strlen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:625:39: [1] (buffer) wcslen: 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 (namelen == (unsigned int) wcslen (p->name)) { data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:656:24: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:677:28: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:690:28: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:695:24: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:767:60: [1] (buffer) wcslen: 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 ( (unsigned int) (nameend - d->__nextchar) == wcslen (p->name)) { data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:785:26: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:799:30: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:811:30: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/3rdparty/getopt/getopt.c:818:26: [1] (buffer) wcslen: 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). d->__nextchar += wcslen (d->__nextchar); data/mbpoll-1.4.11+dfsg/src/mbpoll.c:358: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). int nlen = strlen (needle); data/mbpoll-1.4.11+dfsg/src/mbpoll.c:359: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). int hlen = strlen (haystack) - nlen + 1; ANALYSIS SUMMARY: Hits = 34 Lines analyzed = 3134 in approximately 0.10 seconds (32218 lines/second) Physical Source Lines of Code (SLOC) = 2409 Hits@level = [0] 77 [1] 22 [2] 2 [3] 6 [4] 4 [5] 0 Hits@level+ = [0+] 111 [1+] 34 [2+] 12 [3+] 10 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 46.0772 [1+] 14.1137 [2+] 4.98132 [3+] 4.1511 [4+] 1.66044 [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.