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/lensfun-0.3.95/apps/lenstool/auxfun.h Examining data/lensfun-0.3.95/apps/lenstool/image.cpp Examining data/lensfun-0.3.95/apps/lenstool/image.h Examining data/lensfun-0.3.95/apps/lenstool/lenstool.cpp Examining data/lensfun-0.3.95/apps/lenstool/rgbpixel.h Examining data/lensfun-0.3.95/docs/example/example.c Examining data/lensfun-0.3.95/docs/example/tfun.cpp Examining data/lensfun-0.3.95/libs/getopt/getopt.c Examining data/lensfun-0.3.95/libs/getopt/getopt.h Examining data/lensfun-0.3.95/libs/lensfun/auxfun.cpp Examining data/lensfun-0.3.95/libs/lensfun/camera.cpp Examining data/lensfun-0.3.95/libs/lensfun/cpuid.cpp Examining data/lensfun-0.3.95/libs/lensfun/database.cpp Examining data/lensfun-0.3.95/libs/lensfun/lensfunprv.h Examining data/lensfun-0.3.95/libs/lensfun/mod-color-sse.cpp Examining data/lensfun-0.3.95/libs/lensfun/mod-color-sse2.cpp Examining data/lensfun-0.3.95/libs/lensfun/mod-color.cpp Examining data/lensfun-0.3.95/libs/lensfun/mod-coord-sse.cpp Examining data/lensfun-0.3.95/libs/lensfun/mod-coord.cpp Examining data/lensfun-0.3.95/libs/lensfun/mod-pc.cpp Examining data/lensfun-0.3.95/libs/lensfun/mod-subpix.cpp Examining data/lensfun-0.3.95/libs/lensfun/modifier.cpp Examining data/lensfun-0.3.95/libs/lensfun/windows/mathconstants.h Examining data/lensfun-0.3.95/libs/lensfun/lens.cpp Examining data/lensfun-0.3.95/libs/lensfun/mount.cpp Examining data/lensfun-0.3.95/tests/common_code.hpp Examining data/lensfun-0.3.95/tests/test_database.cpp Examining data/lensfun-0.3.95/tests/test_database_old.cpp Examining data/lensfun-0.3.95/tests/test_lens.cpp Examining data/lensfun-0.3.95/tests/test_lffuzzystrcmp.cpp Examining data/lensfun-0.3.95/tests/test_modifier.cpp Examining data/lensfun-0.3.95/tests/test_modifier_color.cpp Examining data/lensfun-0.3.95/tests/test_modifier_color_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_centering.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_centering_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_distortion.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_distortion_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_geometry.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_geometry_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_perspective_correction.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_perspective_correction_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_scale.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_scale_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_tiny_image.cpp Examining data/lensfun-0.3.95/tests/test_modifier_coord_tiny_image_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_performance.cpp Examining data/lensfun-0.3.95/tests/test_modifier_subpix.cpp Examining data/lensfun-0.3.95/tests/test_modifier_subpix_old.cpp Examining data/lensfun-0.3.95/tests/test_modifier_regression.cpp Examining data/lensfun-0.3.95/tests/test_modifier_regression_old.cpp FINAL RESULTS: data/lensfun-0.3.95/apps/lenstool/lenstool.cpp:24: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 _snprintf data/lensfun-0.3.95/apps/lenstool/lenstool.cpp:24:18: [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 _snprintf data/lensfun-0.3.95/libs/lensfun/lens.cpp:134:9: [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(p, val); data/lensfun-0.3.95/libs/lensfun/mount.cpp:64:9: [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(p, val); data/lensfun-0.3.95/apps/lenstool/lenstool.cpp:137:17: [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, "o:dg::tvaiS:L:C:c:F:A:D:I:h", long_options, NULL)) != EOF) { data/lensfun-0.3.95/docs/example/tfun.cpp:125:17: [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, "L:m:fhV", long_options, NULL)) != EOF) data/lensfun-0.3.95/libs/getopt/getopt.c:201:7: [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 *getenv (); data/lensfun-0.3.95/libs/getopt/getopt.c:378: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. else if (getenv ("POSIXLY_CORRECT") != NULL) data/lensfun-0.3.95/libs/getopt/getopt.c:678: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/lensfun-0.3.95/libs/getopt/getopt.c:680: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 (argc, argv, optstring) data/lensfun-0.3.95/libs/getopt/getopt.c:692:5: [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. int getopt_long (int argc, char *const *argv, const char *shortopts, data/lensfun-0.3.95/libs/getopt/getopt.c:721: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/lensfun-0.3.95/libs/getopt/getopt.h:102: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/lensfun-0.3.95/libs/getopt/getopt.h:104: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/lensfun-0.3.95/libs/getopt/getopt.h:106: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, const char *shortopts, data/lensfun-0.3.95/libs/getopt/getopt.h:118: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/lensfun-0.3.95/libs/getopt/getopt.h:119: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 (); data/lensfun-0.3.95/apps/lenstool/image.cpp:58: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). file = fopen (fName, "rb"); data/lensfun-0.3.95/apps/lenstool/image.cpp:211:16: [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). FILE *fp = fopen (fName, "wb"); data/lensfun-0.3.95/docs/example/tfun.cpp:133:35: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). opts.maxResults = atoi(optarg); data/lensfun-0.3.95/libs/getopt/getopt.c:195:31: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:20:12: [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 lang [16]; data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:25:16: [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. return strcpy (lang, "en"); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:32:16: [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. return strcpy (lang, "en"); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:34: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 (lang, lc_msg, u - lc_msg); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:101: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. memcpy (str + trstr_len, str + def_str_len, str_len - def_str_len); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:105: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. memcpy (str, trstr, trstr_len); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:115: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 (str + str_len, lang, lang_len); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:116: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 (str + str_len + lang_len, trstr, trstr_len); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:136: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 (ret, str, str_len); data/lensfun-0.3.95/libs/lensfun/database.cpp:242:27: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). version = atoi (attribute_values [i]); data/lensfun-0.3.95/libs/lensfun/database.cpp:1178: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. memcpy(ret, search_result.data(), search_result.size() * sizeof(lfCamera*)); data/lensfun-0.3.95/libs/lensfun/database.cpp:1223: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. memcpy(ret, search_result.data(), search_result.size() * sizeof(lfCamera*)); data/lensfun-0.3.95/libs/lensfun/database.cpp:1481: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. memcpy(ret, search_res.data(), search_res.size() * sizeof(lfLens*)); data/lensfun-0.3.95/libs/lensfun/mod-color.cpp:147: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(cd->Terms, lcv.Terms, sizeof(lcv.Terms)); data/lensfun-0.3.95/libs/lensfun/mod-coord.cpp:336: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(cd->Terms, lcd.Terms, sizeof(lcd.Terms)); data/lensfun-0.3.95/libs/lensfun/mod-subpix.cpp:100: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(cd->Terms, lcd.Terms, sizeof(lcd.Terms)); data/lensfun-0.3.95/libs/getopt/getopt.c:486: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). if ((size_t) (s - nextchar) == strlen (p->name)) data/lensfun-0.3.95/libs/getopt/getopt.c:510: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). nextchar += strlen (nextchar); data/lensfun-0.3.95/libs/getopt/getopt.c:540:17: [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). nextchar += strlen (nextchar); data/lensfun-0.3.95/libs/getopt/getopt.c:553:17: [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). nextchar += strlen (nextchar); data/lensfun-0.3.95/libs/getopt/getopt.c:557: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). nextchar += strlen (nextchar); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:85: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 trstr_len = strlen (trstr) + 1; data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:91:19: [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). str_len = strlen (str) + 1; data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:93: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). str_len += 1 + strlen (str + str_len); data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:99: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). size_t def_str_len = str ? strlen (str) + 1 : 0; data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:112: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). size_t lang_len = lang ? strlen (lang) + 1 : 0; data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:128:19: [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). str_len = strlen (str) + 1; data/lensfun-0.3.95/libs/lensfun/auxfun.cpp:130: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). str_len += 2 + strlen (str + str_len + 1); data/lensfun-0.3.95/libs/lensfun/database.cpp:140: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). size_t sl = strlen (fn); data/lensfun-0.3.95/libs/lensfun/database.cpp:876: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 ol = strlen (output); data/lensfun-0.3.95/libs/lensfun/lens.cpp:133: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). char* p = (char*)malloc(strlen(val) + 1); data/lensfun-0.3.95/libs/lensfun/mount.cpp:63: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). char* p = (char*)malloc(strlen(val) + 1); ANALYSIS SUMMARY: Hits = 53 Lines analyzed = 15216 in approximately 0.75 seconds (20287 lines/second) Physical Source Lines of Code (SLOC) = 11362 Hits@level = [0] 22 [1] 16 [2] 20 [3] 13 [4] 4 [5] 0 Hits@level+ = [0+] 75 [1+] 53 [2+] 37 [3+] 17 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 6.60095 [1+] 4.66467 [2+] 3.25647 [3+] 1.49622 [4+] 0.352051 [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.