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/fitspng-1.4/cielab.c Examining data/fitspng-1.4/ecdf.c Examining data/fitspng-1.4/fitspng.c Examining data/fitspng-1.4/fitspng.h Examining data/fitspng-1.4/main.c Examining data/fitspng-1.4/tecdf.c Examining data/fitspng-1.4/tone.c FINAL RESULTS: data/fitspng-1.4/fitspng.c:523:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," of the %s",fval[0]); data/fitspng-1.4/fitspng.c:525:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," taken at %s observatory",fval[6]); data/fitspng-1.4/fitspng.c:527:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," by %s",fval[1]); data/fitspng-1.4/fitspng.c:529:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," by the %s instrument",fval[4]); data/fitspng-1.4/fitspng.c:531:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," of the %s telescope",fval[10]); data/fitspng-1.4/fitspng.c:533:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," at %s UT (start time)",fval[3]); data/fitspng-1.4/fitspng.c:535:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," of exposure %s sec",fval[5]); data/fitspng-1.4/fitspng.c:537:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," with the %s filter",fval[2]); data/fitspng-1.4/fitspng.c:540:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," The instrument temperature: %s.",fval[7]); data/fitspng-1.4/fitspng.c:542:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," XBinnig: %s.",fval[8]); data/fitspng-1.4/fitspng.c:544:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," YBinnig: %s.",fval[9]); data/fitspng-1.4/fitspng.c:573:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%s-%s-%s %s:%s:%02d GMT",tm[0],tm[1],tm[2],tm[3],tm[4],i); data/fitspng-1.4/fitspng.c:576:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%s-%s-%s",tm[0],tm[1],tm[2]); data/fitspng-1.4/fitspng.c:588:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(buf,fval[4]); data/fitspng-1.4/fitspng.c:591:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(buf,fval[10]); data/fitspng-1.4/fitspng.c:596:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf+strlen(buf)," %s",fitsname); data/fitspng-1.4/main.c:299:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(png,fits); data/fitspng-1.4/ecdf.c:59: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(d,data,m); data/fitspng-1.4/ecdf.c:70: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(xcdf,d,m*sizeof(float)); data/fitspng-1.4/fitspng.c:161: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 *fkeys[NFKEYS] = {"OBJECT", "OBSERVER", "FILTER", "DATE-OBS", data/fitspng-1.4/fitspng.c:164: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 *stdkeys[NSTDKEYS] = {"Title","Author","Description","Copyright", data/fitspng-1.4/fitspng.c:167: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 *stdvalues[NSTDKEYS]; data/fitspng-1.4/fitspng.c:168: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 *fval[NFKEYS]; data/fitspng-1.4/fitspng.c:175: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 line[FLEN_CARD]; data/fitspng-1.4/fitspng.c:187: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 buf[NFKEYS*FLEN_CARD + 100]; data/fitspng-1.4/fitspng.c:189: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 *tm[6], *c, *c0; data/fitspng-1.4/fitspng.c:448: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). if( (itt = fopen("itt.dat","w")) ) { data/fitspng-1.4/fitspng.c:465:10: [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). fp = fopen(png, "wb"); data/fitspng-1.4/fitspng.c:521:3: [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. strcpy(buf,"An image"); data/fitspng-1.4/fitspng.c:590:5: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(buf,", "); data/fitspng-1.4/fitspng.c:595:3: [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. strcpy(buf,"Converted from the original FITS image:"); data/fitspng-1.4/main.c:300:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(png,".png"); data/fitspng-1.4/fitspng.c:523: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). sprintf(buf+strlen(buf)," of the %s",fval[0]); data/fitspng-1.4/fitspng.c:525: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). sprintf(buf+strlen(buf)," taken at %s observatory",fval[6]); data/fitspng-1.4/fitspng.c:527: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). sprintf(buf+strlen(buf)," by %s",fval[1]); data/fitspng-1.4/fitspng.c:529: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). sprintf(buf+strlen(buf)," by the %s instrument",fval[4]); data/fitspng-1.4/fitspng.c:531: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). sprintf(buf+strlen(buf)," of the %s telescope",fval[10]); data/fitspng-1.4/fitspng.c:533: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). sprintf(buf+strlen(buf)," at %s UT (start time)",fval[3]); data/fitspng-1.4/fitspng.c:535: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). sprintf(buf+strlen(buf)," of exposure %s sec",fval[5]); data/fitspng-1.4/fitspng.c:537: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). sprintf(buf+strlen(buf)," with the %s filter",fval[2]); data/fitspng-1.4/fitspng.c:538:3: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(buf,"."); data/fitspng-1.4/fitspng.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). sprintf(buf+strlen(buf)," The instrument temperature: %s.",fval[7]); data/fitspng-1.4/fitspng.c:542: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). sprintf(buf+strlen(buf)," XBinnig: %s.",fval[8]); data/fitspng-1.4/fitspng.c:544: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). sprintf(buf+strlen(buf)," YBinnig: %s.",fval[9]); data/fitspng-1.4/fitspng.c:586:3: [1] (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 character. strcpy(buf,""); data/fitspng-1.4/fitspng.c:596:15: [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). sprintf(buf+strlen(buf)," %s",fitsname); data/fitspng-1.4/main.c:292:21: [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( (png = malloc(strlen(fits) + 5)) == NULL ) data/fitspng-1.4/main.c:297:5: [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(png,fits,dot-fits); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 1350 in approximately 0.10 seconds (13783 lines/second) Physical Source Lines of Code (SLOC) = 860 Hits@level = [0] 50 [1] 16 [2] 15 [3] 0 [4] 17 [5] 0 Hits@level+ = [0+] 98 [1+] 48 [2+] 32 [3+] 17 [4+] 17 [5+] 0 Hits/KSLOC@level+ = [0+] 113.953 [1+] 55.814 [2+] 37.2093 [3+] 19.7674 [4+] 19.7674 [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.