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/dmtx-utils-0.7.6/common/dmtxutil.c Examining data/dmtx-utils-0.7.6/common/dmtxutil.h Examining data/dmtx-utils-0.7.6/common/getopt.c Examining data/dmtx-utils-0.7.6/common/getopt.h Examining data/dmtx-utils-0.7.6/common/getopt1.c Examining data/dmtx-utils-0.7.6/common/getopt_int.h Examining data/dmtx-utils-0.7.6/common/gettext.h Examining data/dmtx-utils-0.7.6/dmtxquery/dmtxquery.c Examining data/dmtx-utils-0.7.6/dmtxquery/dmtxquery.h Examining data/dmtx-utils-0.7.6/dmtxread/dmtxread.h Examining data/dmtx-utils-0.7.6/dmtxread/dmtxread.c Examining data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.h Examining data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c FINAL RESULTS: data/dmtx-utils-0.7.6/common/dmtxutil.c:51:4: [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, fmt, va); data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.h:53:9: [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 snprintf sprintf_s data/dmtx-utils-0.7.6/common/getopt.c:146:9: [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. #ifndef getenv data/dmtx-utils-0.7.6/common/getopt.c:147:14: [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. extern char *getenv (); data/dmtx-utils-0.7.6/common/getopt.c:284:28: [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 = !!getenv ("POSIXLY_CORRECT"); data/dmtx-utils-0.7.6/common/getopt.c:1147:1: [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. getopt (int argc, char *const *argv, const char *optstring) data/dmtx-utils-0.7.6/common/getopt.c:1172:11: [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. c = getopt (argc, argv, "abc:d:0123456789"); data/dmtx-utils-0.7.6/common/getopt.h:152:12: [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. extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) data/dmtx-utils-0.7.6/common/getopt.h:155:12: [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. extern int getopt (); data/dmtx-utils-0.7.6/common/getopt.h:159:12: [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. extern int getopt_long (int ___argc, char *const *___argv, data/dmtx-utils-0.7.6/common/getopt1.c:64:1: [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. getopt_long (int argc, char *const *argv, const char *options, data/dmtx-utils-0.7.6/common/getopt1.c:127: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. c = getopt_long (argc, argv, "abc:d:0123456789", data/dmtx-utils-0.7.6/dmtxquery/dmtxquery.c:94:13: [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. opt = getopt_long(*argcp, *argvp, "V", longOptions, &longIndex); data/dmtx-utils-0.7.6/dmtxread/dmtxread.c:292: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. optchr = getopt_long(*argcp, *argvp, data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:181: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. optchr = getopt_long(*argcp, *argvp, "cd:m:e:f:lo:pr:s:C:B:MR:G:vV", longOptions, &longIndex); data/dmtx-utils-0.7.6/common/gettext.h:201: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/dmtx-utils-0.7.6/common/gettext.h:203: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/dmtx-utils-0.7.6/common/gettext.h:211:7: [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_ctxt_id, msgctxt, msgctxt_len - 1); data/dmtx-utils-0.7.6/common/gettext.h:213:7: [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_ctxt_id + msgctxt_len, msgid, msgid_len); data/dmtx-utils-0.7.6/common/gettext.h:247: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/dmtx-utils-0.7.6/common/gettext.h:249: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/dmtx-utils-0.7.6/common/gettext.h:257:7: [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_ctxt_id, msgctxt, msgctxt_len - 1); data/dmtx-utils-0.7.6/common/gettext.h:259:7: [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_ctxt_id + msgctxt_len, msgid, msgid_len); data/dmtx-utils-0.7.6/dmtxread/dmtxread.c:766: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). fp = fopen(imagePath, "wb"); data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:40: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 codeBuffer[DMTXWRITE_BUFFER_SIZE]; data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:130: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(opt.color, black, sizeof(int) * 3); data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:131: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(opt.bgColor, white, sizeof(int) * 3); data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:337:40: [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 = (opt->inputPath == NULL) ? 0 : open(opt->inputPath, O_RDONLY); data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:580: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 style[100]; data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:595:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(opt->outputPath, "wb"); data/dmtx-utils-0.7.6/common/getopt.c:315:49: [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 len = d->__nonoption_flags_max_len = strlen (orig_str); data/dmtx-utils-0.7.6/common/getopt.c:542:21: [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). == (unsigned int) strlen (p->name)) data/dmtx-utils-0.7.6/common/getopt.c:591:21: [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/dmtx-utils-0.7.6/common/getopt.c:664: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). d->__nextchar += strlen (d->__nextchar); data/dmtx-utils-0.7.6/common/getopt.c:704: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). d->__nextchar += strlen (d->__nextchar); data/dmtx-utils-0.7.6/common/getopt.c:709:21: [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/dmtx-utils-0.7.6/common/getopt.c:912:56: [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/dmtx-utils-0.7.6/common/getopt.c:957:23: [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/dmtx-utils-0.7.6/common/getopt.c:1001: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/dmtx-utils-0.7.6/common/getopt.c:1039: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/dmtx-utils-0.7.6/common/getopt.c:1043:23: [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/dmtx-utils-0.7.6/common/gettext.h:197: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/dmtx-utils-0.7.6/common/gettext.h:198: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). size_t msgid_len = strlen (msgid) + 1; data/dmtx-utils-0.7.6/common/gettext.h:243: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/dmtx-utils-0.7.6/common/gettext.h:244: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). size_t msgid_len = strlen (msgid) + 1; data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:203: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). if(strlen(optarg) != 1) { data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:343:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytesRead = read(fd, codeBuffer + bytesReadTotal, DMTXWRITE_BUFFER_SIZE); data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:503: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). if(ptr != NULL && strlen(ptr) > 0 && opt->format != NULL) data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:507: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). if(ptr == NULL || strlen(ptr) == 0) data/dmtx-utils-0.7.6/dmtxwrite/dmtxwrite.c:588: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(idString == NULL || strlen(idString) == 0) ANALYSIS SUMMARY: Hits = 50 Lines analyzed = 4118 in approximately 0.16 seconds (25557 lines/second) Physical Source Lines of Code (SLOC) = 2634 Hits@level = [0] 119 [1] 20 [2] 15 [3] 13 [4] 2 [5] 0 Hits@level+ = [0+] 169 [1+] 50 [2+] 30 [3+] 15 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 64.161 [1+] 18.9825 [2+] 11.3895 [3+] 5.69476 [4+] 0.759301 [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.