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/sunpy-2.0.5/sunpy/_compiler.c Examining data/sunpy-2.0.5/sunpy/io/src/ana/_pyana.c Examining data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.c Examining data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.h Examining data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.c Examining data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.h Examining data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c Examining data/sunpy-2.0.5/sunpy/io/src/ana/anarw.h Examining data/sunpy-2.0.5/sunpy/io/src/ana/types.h FINAL RESULTS: data/sunpy-2.0.5/sunpy/io/src/ana/_pyana.c:57:18: [4] (format) vsnprintf: 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. int wanted = vsnprintf( *sptr = NULL, 0, fmt, argv ); data/sunpy-2.0.5/sunpy/io/src/ana/_pyana.c:62:14: [4] (format) vsnprintf: 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. retval = vsnprintf( *sptr, 1 + wanted, fmt, argv2 ); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:108:16: [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). char *header=strcpy(malloc(strlen(fh.txt)+1),fh.txt); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:140:11: [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). *header=strcpy(malloc(strlen(fh.txt)+1),fh.txt); data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.c:22:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.c:197:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.c:302:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.c:479:14: [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 b[4]; data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.c:627:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anacompress.c:628:34: [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. union { long long l64; unsigned char b[8]; } yy; data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.c:18:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.c:19:34: [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. union { long long l64; unsigned char b[8]; } yy; data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.c:139:18: [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 b[4]; data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.c:303:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.c:400:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anadecompress.c:542:35: [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. union { int i; short w; unsigned char b[4]; } y; data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:99:13: [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 *fin=fopen(file_name,"r"); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:127:13: [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 *fin=fopen(file_name,"r"); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:214:11: [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 *f=fopen(file_name,"w"); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:281:11: [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 *f=fopen(file_name,"w"); data/sunpy-2.0.5/sunpy/io/src/ana/types.h:27: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 txt[256]; data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:108: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). char *header=strcpy(malloc(strlen(fh.txt)+1),fh.txt); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:140:25: [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). *header=strcpy(malloc(strlen(fh.txt)+1),fh.txt); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:258: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). int len=fmin(strlen(header),255); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:259:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fh.txt,header,len); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:317: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). int len=fmin(strlen(header),255); data/sunpy-2.0.5/sunpy/io/src/ana/anarw.c:318:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fh.txt,header,len); ANALYSIS SUMMARY: Hits = 27 Lines analyzed = 2346 in approximately 0.21 seconds (11058 lines/second) Physical Source Lines of Code (SLOC) = 1776 Hits@level = [0] 56 [1] 6 [2] 17 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 83 [1+] 27 [2+] 21 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 46.7342 [1+] 15.2027 [2+] 11.8243 [3+] 2.25225 [4+] 2.25225 [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.