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/fitscut-1.4.4/util.h
Examining data/fitscut-1.4.4/util.c
Examining data/fitscut-1.4.4/getopt.c
Examining data/fitscut-1.4.4/extract.c
Examining data/fitscut-1.4.4/getopt.h
Examining data/fitscut-1.4.4/file_check.h
Examining data/fitscut-1.4.4/file_check.c
Examining data/fitscut-1.4.4/output_fits.c
Examining data/fitscut-1.4.4/wcs_align.h
Examining data/fitscut-1.4.4/tailor.h
Examining data/fitscut-1.4.4/extract.h
Examining data/fitscut-1.4.4/resize.c
Examining data/fitscut-1.4.4/image_scale.h
Examining data/fitscut-1.4.4/resize.h
Examining data/fitscut-1.4.4/fitscut.h
Examining data/fitscut-1.4.4/getopt1.c
Examining data/fitscut-1.4.4/draw.c
Examining data/fitscut-1.4.4/output_png.c
Examining data/fitscut-1.4.4/colormap.c
Examining data/fitscut-1.4.4/output_jpg.h
Examining data/fitscut-1.4.4/output_png.h
Examining data/fitscut-1.4.4/output_fits.h
Examining data/fitscut-1.4.4/colormap.h
Examining data/fitscut-1.4.4/output_jpg.c
Examining data/fitscut-1.4.4/revision.h
Examining data/fitscut-1.4.4/draw.h
Examining data/fitscut-1.4.4/histogram.h
Examining data/fitscut-1.4.4/fitscut.c
Examining data/fitscut-1.4.4/wcs_align.c
Examining data/fitscut-1.4.4/histogram.c
Examining data/fitscut-1.4.4/image_scale.c

FINAL RESULTS:

data/fitscut-1.4.4/file_check.c:228:16:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
        (void) chmod (ofname, 0777);
data/fitscut-1.4.4/tailor.h:209:11:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
#  define chmod(file, mode) (0)
data/fitscut-1.4.4/file_check.c:101:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf (ofname, "%s", oname);
data/fitscut-1.4.4/fitscut.c:191:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf (stderr, format, args);
data/fitscut-1.4.4/fitscut.c:245:9:  [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.
        fprintf (stderr, usage, progname);
data/fitscut-1.4.4/fitscut.h:87:32:  [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 WARN(msg) {if (!quiet) fprintf msg ; \
data/fitscut-1.4.4/output_fits.c:208:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf (history, "Created by fitscut %s (William Jon McCann)", VERSION);
data/fitscut-1.4.4/output_jpg.c:327:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf (comment_text, "Created by fitscut %s (William Jon McCann)", VERSION);
data/fitscut-1.4.4/output_png.c:342:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf (comment_text, "Created by fitscut %s (William Jon McCann)", VERSION);
data/fitscut-1.4.4/wcs_align.c:179:9:  [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 (wcs_in->radecout, wcs_out->radecsys);
data/fitscut-1.4.4/fitscut.c:558:24:  [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.
        while ((optc = getopt_long (argc, argv, "hviVfpjlsex:y:r:c:a:t:",
data/fitscut-1.4.4/getopt.c:195:7:  [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.
char *getenv ();
data/fitscut-1.4.4/getopt.c:355: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.
      else if (getenv ("POSIXLY_CORRECT") != NULL)
data/fitscut-1.4.4/getopt.c:654:1:  [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.
getopt (argc, argv, optstring)
data/fitscut-1.4.4/getopt.c:684:11:  [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.
      c = getopt (argc, argv, "abc:d:0123456789");
data/fitscut-1.4.4/getopt.h:102:12:  [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.
extern int getopt (int argc, char *const *argv, const char *shortopts);
data/fitscut-1.4.4/getopt.h:104:12:  [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.
extern int getopt ();
data/fitscut-1.4.4/getopt.h:106:12:  [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.
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
data/fitscut-1.4.4/getopt.h:118:12:  [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.
extern int getopt ();
data/fitscut-1.4.4/getopt.h:119:12:  [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.
extern int getopt_long ();
data/fitscut-1.4.4/getopt1.c:47:7:  [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.
char *getenv ();
data/fitscut-1.4.4/getopt1.c:55:1:  [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.
getopt_long (argc, argv, options, long_options, opt_index)
data/fitscut-1.4.4/getopt1.c:111:11:  [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, "abc:d:0123456789",
data/fitscut-1.4.4/extract.c:264:9:  [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 keyname[FLEN_KEYWORD];
data/fitscut-1.4.4/extract.c:266:9:  [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 card[FLEN_CARD+1];
data/fitscut-1.4.4/extract.c:267:9:  [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 value_string[FLEN_VALUE];
data/fitscut-1.4.4/extract.c:268:9:  [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 comment[FLEN_COMMENT];
data/fitscut-1.4.4/file_check.c:56: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 fits_suffix[MAX_SUFFIX+1]; /* default suffix */
data/fitscut-1.4.4/file_check.c:213:17:  [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 response[80];
data/fitscut-1.4.4/fitscut.c:524:9:  [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 ofname[MAX_PATH_LEN];
data/fitscut-1.4.4/fitscut.c:547:21:  [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.
        progname = (char *) basename (argv[0]);
data/fitscut-1.4.4/fitscut.h:159:9:  [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 *input_filename[MAX_CHANNELS];
data/fitscut-1.4.4/fitscut.h:178:9:  [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 *header[MAX_CHANNELS];
data/fitscut-1.4.4/getopt.c:189:31:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
#define	my_bcopy(src, dst, n)	memcpy ((dst), (src), (n))
data/fitscut-1.4.4/output_fits.c:139:9:  [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 keyname[FLEN_KEYWORD];
data/fitscut-1.4.4/output_fits.c:141:9:  [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 card[FLEN_CARD+1];
data/fitscut-1.4.4/output_fits.c:186:9:  [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 history[64];
data/fitscut-1.4.4/output_jpg.c:274:9:  [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 comment_text[64];
data/fitscut-1.4.4/output_jpg.c:289:27:  [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).
                outfile = fopen (Image->output_filename, "wb");
data/fitscut-1.4.4/output_png.c:268:9:  [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 comment_text[64];
data/fitscut-1.4.4/output_png.c:282:22:  [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(Image->output_filename,"wb");
data/fitscut-1.4.4/resize.c:253:25:  [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 (data, linep, bytespp * npixels);
data/fitscut-1.4.4/resize.c:281:17:  [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 (linep, data, bytespp * npixels);
data/fitscut-1.4.4/tailor.h:210:35:  [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).
#  define OPEN(name, flags, mode) open(name, flags)
data/fitscut-1.4.4/tailor.h:300:35:  [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).
#  define OPEN(name, flags, mode) open(name, flags, mode)
data/fitscut-1.4.4/extract.c:274:25:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                        strncpy (card, header + i * (FLEN_CARD - 1), FLEN_CARD - 1);
data/fitscut-1.4.4/file_check.c:133: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).
        int s = strlen (name);
data/fitscut-1.4.4/file_check.c:214:17:  [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 (response,"n");
data/fitscut-1.4.4/fitscut.c:548:19:  [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).
        proglen = strlen (progname);
data/fitscut-1.4.4/fitscut.c:903:25:  [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 (ofname, "-");
data/fitscut-1.4.4/fitscut.c:913:33:  [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 (ofname, "-");
data/fitscut-1.4.4/fitscut.c:929:33:  [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 (ofname,"-");
data/fitscut-1.4.4/getopt.c:463:26:  [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 (s - nextchar == strlen (p->name))
data/fitscut-1.4.4/getopt.c:487:16:  [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).
	  nextchar += strlen (nextchar);
data/fitscut-1.4.4/getopt.c:517: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).
		  nextchar += strlen (nextchar);
data/fitscut-1.4.4/getopt.c:530: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).
		  nextchar += strlen (nextchar);
data/fitscut-1.4.4/getopt.c:534:16:  [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).
	  nextchar += strlen (nextchar);
data/fitscut-1.4.4/output_fits.c:126:13:  [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 (strlen (ofname) <= 0) {
data/fitscut-1.4.4/output_fits.c:149:25:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                        strncpy (card, header + i * (FLEN_CARD - 1), FLEN_CARD - 1);
data/fitscut-1.4.4/output_jpg.c:328:60:  [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).
        jpeg_write_marker (&cinfo, JPEG_COM, comment_text, strlen (comment_text));
data/fitscut-1.4.4/util.c:97: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).
        for (i = 0; i < strlen (str); i++) {

ANALYSIS SUMMARY:

Hits = 61
Lines analyzed = 6348 in approximately 0.20 seconds (31778 lines/second)
Physical Source Lines of Code (SLOC) = 4468
Hits@level = [0]  44 [1]  16 [2]  22 [3]  13 [4]   8 [5]   2
Hits@level+ = [0+] 105 [1+]  61 [2+]  45 [3+]  23 [4+]  10 [5+]   2
Hits/KSLOC@level+ = [0+] 23.5004 [1+] 13.6526 [2+] 10.0716 [3+] 5.14772 [4+] 2.23814 [5+] 0.447628
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.