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/gpscorrelate-2.0/correlate.c Examining data/gpscorrelate-2.0/correlate.h Examining data/gpscorrelate-2.0/exif-gps.cpp Examining data/gpscorrelate-2.0/exif-gps.h Examining data/gpscorrelate-2.0/gpsstructure.h Examining data/gpscorrelate-2.0/gpx-read.c Examining data/gpscorrelate-2.0/gpx-read.h Examining data/gpscorrelate-2.0/gui.c Examining data/gpscorrelate-2.0/gui.h Examining data/gpscorrelate-2.0/i18n.h Examining data/gpscorrelate-2.0/latlong.c Examining data/gpscorrelate-2.0/latlong.h Examining data/gpscorrelate-2.0/main-command.c Examining data/gpscorrelate-2.0/main-gui.c Examining data/gpscorrelate-2.0/unixtime.c Examining data/gpscorrelate-2.0/unixtime.h FINAL RESULTS: data/gpscorrelate-2.0/exif-gps.cpp:53:23: [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. #define DEBUGLOG(...) fprintf(stderr, __VA_ARGS__) data/gpscorrelate-2.0/latlong.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(str, latlongstr); data/gpscorrelate-2.0/unixtime.c:91:2: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. sscanf(StringTime, Format, &Time.tm_year, &Time.tm_mon, data/gpscorrelate-2.0/main-command.c:322:7: [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, "g:z:il:hvd:m:nsortRMVfO:", data/gpscorrelate-2.0/unixtime.c:47:8: [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. tz = getenv("TZ"); data/gpscorrelate-2.0/exif-gps.cpp:103:32: [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). Image = Exiv2::ImageFactory::open(File); data/gpscorrelate-2.0/exif-gps.cpp:160:32: [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). Image = Exiv2::ImageFactory::open(File); data/gpscorrelate-2.0/exif-gps.cpp:298:32: [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). Image = Exiv2::ImageFactory::open(File); data/gpscorrelate-2.0/exif-gps.cpp:469:32: [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). Image = Exiv2::ImageFactory::open(File); data/gpscorrelate-2.0/exif-gps.cpp:491: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 ScratchBuf[100]; data/gpscorrelate-2.0/exif-gps.cpp:649:32: [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). Image = Exiv2::ImageFactory::open(File); data/gpscorrelate-2.0/exif-gps.cpp:666: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 ScratchBuf[100]; data/gpscorrelate-2.0/exif-gps.cpp:711:32: [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). Image = Exiv2::ImageFactory::open(File); data/gpscorrelate-2.0/gui.c:228:15: [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). OutputFile = fopen(SettingsFilename, "w"); data/gpscorrelate-2.0/gui.c:265: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 title[40]; data/gpscorrelate-2.0/gui.c:1109: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 LatScratch[100] = ""; data/gpscorrelate-2.0/gui.c:1110: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 LongScratch[100] = ""; data/gpscorrelate-2.0/gui.c:1111: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 ElevScratch[100] = ""; data/gpscorrelate-2.0/gui.c:1417: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). Options.TimeZoneHours = atoi(TZString); data/gpscorrelate-2.0/gui.c:1421:24: [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). Options.PhotoOffset = atoi(gtk_entry_get_text(GTK_ENTRY(PhotoOffsetEntry))); data/gpscorrelate-2.0/latlong.c:236: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(p1, latlong, sizeof(*p1)); data/gpscorrelate-2.0/latlong.c:240: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(p2, latlong, sizeof(*p2)); data/gpscorrelate-2.0/main-command.c:214: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 DateStamp[12]; data/gpscorrelate-2.0/main-command.c:215: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 TimeStamp[12]; data/gpscorrelate-2.0/main-command.c:216: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 CombinedTime[24]; data/gpscorrelate-2.0/main-command.c:247: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 PhotoTimeFormat[100]; data/gpscorrelate-2.0/main-command.c:248: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 GPSTimeFormat[100]; data/gpscorrelate-2.0/main-command.c:400:23: [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). TimeZoneHours = atoi(optarg); data/gpscorrelate-2.0/main-command.c:408:20: [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). PhotoOffset = atoi(optarg); data/gpscorrelate-2.0/main-command.c:439:20: [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). FeatherTime = atoi(optarg); data/gpscorrelate-2.0/exif-gps.cpp:497:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read("2 2 0 0"); data/gpscorrelate-2.0/exif-gps.cpp:512:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read("0"); data/gpscorrelate-2.0/exif-gps.cpp:514:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read("1"); data/gpscorrelate-2.0/exif-gps.cpp:524:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read(ScratchBuf); data/gpscorrelate-2.0/exif-gps.cpp:570:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read(ScratchBuf); data/gpscorrelate-2.0/exif-gps.cpp:594:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read(ScratchBuf); data/gpscorrelate-2.0/exif-gps.cpp:607:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read(ScratchBuf); data/gpscorrelate-2.0/exif-gps.cpp:679:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Value->read(ScratchBuf); data/gpscorrelate-2.0/gui.c:192: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). const int FilenameLength = strlen(UserHomeDir) + 30; data/gpscorrelate-2.0/gui.c:1288:32: [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). const size_t ScratchLength = strlen(FirstOrBadFileName) + 100; data/gpscorrelate-2.0/latlong.c:67:32: [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 (!str || !point || !num || strlen(num) != strspn(num, DEC_NUMS)) data/gpscorrelate-2.0/latlong.c:76: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). if (!num || strlen(num) != strspn(num, DEC_NUMS)) data/gpscorrelate-2.0/latlong.c:85: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). if (!num || strlen(num) != strspn(num, DEC_NUMS)) { data/gpscorrelate-2.0/latlong.c:130: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). if (!num || strlen(num) != strspn(num, D_DIGITS)) data/gpscorrelate-2.0/latlong.c:143: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). if (!num || strlen(num) != strspn(num, M_DIGITS)) data/gpscorrelate-2.0/latlong.c:152: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). if (!num || strlen(num) != strspn(num, S_DIGITS)) data/gpscorrelate-2.0/latlong.c:159: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). *endstr = num + strlen(num) + 1; data/gpscorrelate-2.0/latlong.c:175: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). char *str = (char *)calloc(strlen(latlongstr)+2, 1); data/gpscorrelate-2.0/main-command.c:110:31: [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 *newstr = (char*)malloc(strlen(str)*2+1); // worst-case size ANALYSIS SUMMARY: Hits = 49 Lines analyzed = 4568 in approximately 0.32 seconds (14256 lines/second) Physical Source Lines of Code (SLOC) = 2819 Hits@level = [0] 83 [1] 19 [2] 25 [3] 2 [4] 3 [5] 0 Hits@level+ = [0+] 132 [1+] 49 [2+] 30 [3+] 5 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 46.8251 [1+] 17.3821 [2+] 10.6421 [3+] 1.77368 [4+] 1.06421 [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.