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/metar-20190227.1/src/main.c
Examining data/metar-20190227.1/src/metar.c
Examining data/metar-20190227.1/src/metar.h

FINAL RESULTS:

data/metar-20190227.1/src/metar.c:126:4:  [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(&pattern[p], observations[i].code);
data/metar-20190227.1/src/main.c:75:6:  [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.
	if (getenv("METARURL") == NULL) {
data/metar-20190227.1/src/main.c:78: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.
		strncpy(tmp, getenv("METARURL"), URL_MAXSIZE);
data/metar-20190227.1/src/main.c:161:16:  [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.
	while ((res = getopt(argc, argv, "hvd")) != -1) {
data/metar-20190227.1/src/main.c:31:1:  [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 noaabuffer[METAR_MAXSIZE];
data/metar-20190227.1/src/main.c:68: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 url[URL_MAXSIZE];
data/metar-20190227.1/src/main.c:69: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 tmp[URL_MAXSIZE];
data/metar-20190227.1/src/metar.c:158: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 tmp[99];
data/metar-20190227.1/src/metar.c:159: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 obspattern[255];
data/metar-20190227.1/src/metar.c:160: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 obsp[275];
data/metar-20190227.1/src/metar.c:172: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(metar->station, token+pmatch[1].rm_so, 
data/metar-20190227.1/src/metar.c:188: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(tmp, token+pmatch[1].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:193: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(tmp, token+pmatch[2].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:213: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(tmp, token+pmatch[1].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:224: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(tmp, token+pmatch[2].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:231: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(tmp, token+pmatch[3].rm_so+1, (size < 99 ? size-1 : 99));
data/metar-20190227.1/src/metar.c:239: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(&metar->windunit, token+pmatch[4].rm_so, 
data/metar-20190227.1/src/metar.c:259: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(tmp, token+pmatch[1].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:265: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(&metar->visunit, token+pmatch[2].rm_so, 
data/metar-20190227.1/src/metar.c:285: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(tmp, token+pmatch[2].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:290: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(tmp, token+pmatch[1].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:295: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(tmp, token+pmatch[4].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:300: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(tmp, token+pmatch[3].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:318: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(tmp, token+pmatch[1].rm_so, (size < 5 ? size : 5));
data/metar-20190227.1/src/metar.c:330: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(tmp, token+pmatch[2].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:350:3:  [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(&cloud->type, token+pmatch[1].rm_so, (size < 3 ? size : 3));
data/metar-20190227.1/src/metar.c:354:3:  [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(tmp, token+pmatch[2].rm_so, (size < 3 ? size : 3));
data/metar-20190227.1/src/metar.c:386:3:  [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(tmp, token+pmatch[1].rm_so, (size < 1 ? size : 1));
data/metar-20190227.1/src/metar.c:393:3:  [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(tmp, token+pmatch[2].rm_so, (size < 99 ? size : 99));
data/metar-20190227.1/src/metar.c:396: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 code[2];
data/metar-20190227.1/src/metar.c:399: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(code, tmp+i, 2);
data/metar-20190227.1/src/metar.c:460: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(noaa->date, noaa_data+pmatch[1].rm_so, (size < 36 ? size : 36));
data/metar-20190227.1/src/metar.c:464:3:  [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(noaa->report, noaa_data+pmatch[2].rm_so, 
data/metar-20190227.1/src/metar.h:31: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 type[3];
data/metar-20190227.1/src/metar.h:49: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 station[10];
data/metar-20190227.1/src/metar.h:55: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 windunit[5];
data/metar-20190227.1/src/metar.h:57: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 visunit[5];
data/metar-20190227.1/src/metar.h:59: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 qnhunit[5];
data/metar-20190227.1/src/metar.h:68: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 date[36];
data/metar-20190227.1/src/metar.h:69: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 report[1024];
data/metar-20190227.1/src/main.c:59:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(noaabuffer, buffer, size);
data/metar-20190227.1/src/main.c:76:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(tmp, METARURL, URL_MAXSIZE);
data/metar-20190227.1/src/main.c:78:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(tmp, getenv("METARURL"), URL_MAXSIZE);
data/metar-20190227.1/src/metar.c:124:7:  [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).
		p = strlen(pattern);
data/metar-20190227.1/src/metar.c:125:11:  [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 (p + strlen(observations[i].code) < len)
data/metar-20190227.1/src/metar.c:129:7:  [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).
		p = strlen(pattern);
data/metar-20190227.1/src/metar.c:134:10:  [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).
	pattern[strlen(pattern)-1] = 0;
data/metar-20190227.1/src/metar.c:268:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant character.
				strncpy(metar->visunit, "M", 1);
data/metar-20190227.1/src/metar.c:320:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
				strncpy(metar->qnhunit, "hPa", 3);
data/metar-20190227.1/src/metar.c:322:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
				strncpy(metar->qnhunit, "\"Hg", 3);
data/metar-20190227.1/src/metar.c:326:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
				strncpy(metar->qnhunit, "Unkn", 4);
data/metar-20190227.1/src/metar.c:387:22:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
		if (tmp[0] == '-') strncpy(obs, "Light ", 99);
data/metar-20190227.1/src/metar.c:388:27:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
		else if (tmp[0] == '+') strncpy(obs, "Heavy ", 99);
data/metar-20190227.1/src/metar.c:397: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).
		while (i < strlen(tmp)) {
data/metar-20190227.1/src/metar.c:400:4:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
			strncat(obs, decode_obs(code), 99);
data/metar-20190227.1/src/metar.c:405:7:  [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).
		obs[strlen(obs)-1]=0;

ANALYSIS SUMMARY:

Hits = 56
Lines analyzed = 749 in approximately 0.04 seconds (20052 lines/second)
Physical Source Lines of Code (SLOC) = 532
Hits@level = [0]  54 [1]  16 [2]  36 [3]   3 [4]   1 [5]   0
Hits@level+ = [0+] 110 [1+]  56 [2+]  40 [3+]   4 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 206.767 [1+] 105.263 [2+] 75.188 [3+] 7.5188 [4+] 1.8797 [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.