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/wmforecast-1.4/wmforecast.c FINAL RESULTS: data/wmforecast-1.4/wmforecast.c:220:3: [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(weather->errorText, errorText); data/wmforecast-1.4/wmforecast.c:243:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/%s.png", icondir, code); data/wmforecast-1.4/wmforecast.c:268: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(forecast->day, day); data/wmforecast-1.4/wmforecast.c:270: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(forecast->low, low); data/wmforecast-1.4/wmforecast.c:272: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(forecast->high, high); data/wmforecast-1.4/wmforecast.c:274: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(forecast->text, text); data/wmforecast-1.4/wmforecast.c:667:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(filename, F_OK) != 0) { data/wmforecast-1.4/wmforecast.c:757: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, "vhu:i:b:t:p:l:I:nwd:", data/wmforecast-1.4/wmforecast.c:115: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 retrieved[20]; data/wmforecast-1.4/wmforecast.c:235: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 filename[1024]; data/wmforecast-1.4/wmforecast.c:412: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 temp[4]; data/wmforecast-1.4/wmforecast.c:415:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(temp, "%d", round(temp_double)); data/wmforecast-1.4/wmforecast.c:456:5: [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 high_text[12], low_text[12]; data/wmforecast-1.4/wmforecast.c:648:8: [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. const char icon_names[10][30] = { data/wmforecast-1.4/wmforecast.c:826:18: [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). prefs->days = atoi(optarg); data/wmforecast-1.4/wmforecast.c:928: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 latitude[10], longitude[10]; data/wmforecast-1.4/wmforecast.c:930:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(latitude, "%.4f", data/wmforecast-1.4/wmforecast.c:932:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(longitude, "%.4f", data/wmforecast-1.4/wmforecast.c:994: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 intervalPtr[50]; data/wmforecast-1.4/wmforecast.c:1053:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(intervalPtr, "%.4f", d->prefsWindow->prefs->latitude); data/wmforecast-1.4/wmforecast.c:1070:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(intervalPtr, "%.4f", d->prefsWindow->prefs->longitude); data/wmforecast-1.4/wmforecast.c:1101:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(intervalPtr, "%lu", d->prefsWindow->prefs->interval); data/wmforecast-1.4/wmforecast.c:219: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). weather->errorText, strlen(errorText) + 1); data/wmforecast-1.4/wmforecast.c:267:42: [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). forecast->day = wrealloc(forecast->day, strlen(day) + 1); data/wmforecast-1.4/wmforecast.c:269:42: [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). forecast->low = wrealloc(forecast->low, strlen(low) + 1); data/wmforecast-1.4/wmforecast.c:271:44: [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). forecast->high = wrealloc(forecast->high, strlen(high) + 1); data/wmforecast-1.4/wmforecast.c:273:44: [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). forecast->text = wrealloc(forecast->text, strlen(text) + 1); ANALYSIS SUMMARY: Hits = 27 Lines analyzed = 1249 in approximately 0.04 seconds (29376 lines/second) Physical Source Lines of Code (SLOC) = 1035 Hits@level = [0] 8 [1] 5 [2] 14 [3] 1 [4] 7 [5] 0 Hits@level+ = [0+] 35 [1+] 27 [2+] 22 [3+] 8 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 33.8164 [1+] 26.087 [2+] 21.256 [3+] 7.72947 [4+] 6.76329 [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.