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/scrot-1.4/src/debug.h
Examining data/scrot-1.4/src/getopt.c
Examining data/scrot-1.4/src/getopt.h
Examining data/scrot-1.4/src/getopt1.c
Examining data/scrot-1.4/src/imlib.c
Examining data/scrot-1.4/src/main.c
Examining data/scrot-1.4/src/note.c
Examining data/scrot-1.4/src/note.h
Examining data/scrot-1.4/src/options.c
Examining data/scrot-1.4/src/options.h
Examining data/scrot-1.4/src/scrot.h
Examining data/scrot-1.4/src/structs.h

FINAL RESULTS:

data/scrot-1.4/src/main.c:195: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(curfile, F_OK) == -1) return;
data/scrot-1.4/src/main.c:226:36:  [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.
  } while ((count < max_count) && (access(curfile, F_OK) == 0));
data/scrot-1.4/src/main.c:308:9:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  ret = system(execstr);
data/scrot-1.4/src/main.c:676:11:  [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(ret, buf);
data/scrot-1.4/src/main.c:680:13:  [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(ret, filename_im);
data/scrot-1.4/src/main.c:684:13:  [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(ret, filename_thumb);
data/scrot-1.4/src/main.c:690:15:  [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(ret, tmp + 1);
data/scrot-1.4/src/main.c:692:15:  [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(ret, filename_im);
data/scrot-1.4/src/main.c:697:11:  [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(ret, buf);
data/scrot-1.4/src/main.c:701:11:  [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(ret, buf);
data/scrot-1.4/src/main.c:710:15:  [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(ret, buf);
data/scrot-1.4/src/main.c:719:11:  [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(ret, buf);
data/scrot-1.4/src/main.c:724:13:  [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(ret, gib_imlib_image_format(im));
data/scrot-1.4/src/options.c:319:7:  [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(new_title, dot_pos);
data/scrot-1.4/src/options.c:322:7:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
      sprintf(new_title, "%s-thumb", name);
data/scrot-1.4/src/options.c:428:4:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
   printf(SCROT_PACKAGE " version " SCROT_VERSION "\n");
data/scrot-1.4/src/getopt.c:208: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/scrot-1.4/src/getopt.c:400:22:  [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.
   posixly_correct = getenv("POSIXLY_CORRECT");
data/scrot-1.4/src/getopt.c:966: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/scrot-1.4/src/getopt.c:994: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/scrot-1.4/src/getopt.h:105:15:  [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/scrot-1.4/src/getopt.h:110:15:  [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/scrot-1.4/src/getopt.h:113:15:  [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/scrot-1.4/src/getopt.h:125:15:  [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/scrot-1.4/src/getopt.h:126:15:  [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/scrot-1.4/src/getopt1.c:66: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/scrot-1.4/src/getopt1.c:122:10:  [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, "abc:d:0123456789", long_options,
data/scrot-1.4/src/imlib.c:54: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.
              (getenv("DISPLAY") ? getenv("DISPLAY") : "NULL"));
data/scrot-1.4/src/imlib.c:54:36:  [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.
              (getenv("DISPLAY") ? getenv("DISPLAY") : "NULL"));
data/scrot-1.4/src/options.c:196:20:  [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 ((optch = getopt_long(argc, argv, stropts, lopts, &cmdx)) !=
data/scrot-1.4/src/main.c:202: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 fmt[5];
data/scrot-1.4/src/main.c:212: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(newname, curfile, slen - 4);
data/scrot-1.4/src/main.c:214: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(newname, curfile, slen);
data/scrot-1.4/src/main.c:657: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[20];
data/scrot-1.4/src/main.c:658: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 ret[4096];
data/scrot-1.4/src/main.c:659: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 strf[4096];
data/scrot-1.4/src/main.c:712:15:  [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(ret, "[err]");
data/scrot-1.4/src/main.c:887: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 newdisp[255];
data/scrot-1.4/src/options.c:318:7:  [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(new_title, "-thumb");
data/scrot-1.4/src/options.c:331:10:  [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 tokdelim[2] = ",";
data/scrot-1.4/src/getopt.c:232:12:  [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).
extern int strlen(const char *);
data/scrot-1.4/src/getopt.c:431:49:  [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 = nonoption_flags_max_len = strlen(orig_str);
data/scrot-1.4/src/getopt.c:655:32:  [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).
                (unsigned int) strlen(p->name))
data/scrot-1.4/src/getopt.c:679:22:  [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/scrot-1.4/src/getopt.c:712:28:  [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/scrot-1.4/src/getopt.c:727:28:  [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/scrot-1.4/src/getopt.c:732:22:  [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/scrot-1.4/src/getopt.c:841:59:  [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 ((unsigned int) (nameend - nextchar) == strlen(p->name))
data/scrot-1.4/src/getopt.c:864: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).
            nextchar += strlen(nextchar);
data/scrot-1.4/src/getopt.c:883:31:  [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/scrot-1.4/src/getopt.c:897:31:  [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/scrot-1.4/src/getopt.c:901: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).
            nextchar += strlen(nextchar);
data/scrot-1.4/src/main.c:186: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).
    return (ext && (strlen(ext + 1) == 3)) ? ext : NULL;
data/scrot-1.4/src/main.c:200:23:  [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).
  const size_t slen = strlen(curfile);
data/scrot-1.4/src/main.c:220:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(newname + slen, fmt, 5);
data/scrot-1.4/src/main.c:222:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy((newname + slen)-4, fmt, 5);
data/scrot-1.4/src/main.c:223:9:  [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(newname, extension, 4);
data/scrot-1.4/src/main.c:728:11:  [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(ret, "$");
data/scrot-1.4/src/main.c:731:11:  [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(ret, c, 1);
data/scrot-1.4/src/main.c:739:13:  [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(ret, "\n");
data/scrot-1.4/src/main.c:742:11:  [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(ret, c, 1);
data/scrot-1.4/src/main.c:746: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).
      const size_t len = strlen(ret);
data/scrot-1.4/src/note.c:67:31:  [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 *const end = format + strlen(format);
data/scrot-1.4/src/note.c:71: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 ((NULL == tok) || (strlen(tok) == 1)) {
data/scrot-1.4/src/note.c:261:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
   strncpy(text, src, len);
data/scrot-1.4/src/options.c:284: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).
            if ( strlen(opt.output_file) > 256 ) {
data/scrot-1.4/src/options.c:309: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).
   length = strlen(name) + 7;
data/scrot-1.4/src/options.c:317:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(new_title, name, diff);
data/scrot-1.4/src/options.c:366: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).
   length = strlen(optarg) + 1;
data/scrot-1.4/src/options.c:371:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
   strncpy(new_display, optarg, length);

ANALYSIS SUMMARY:

Hits = 70
Lines analyzed = 3530 in approximately 0.11 seconds (31106 lines/second)
Physical Source Lines of Code (SLOC) = 2368
Hits@level = [0]  89 [1]  30 [2]  10 [3]  14 [4]  16 [5]   0
Hits@level+ = [0+] 159 [1+]  70 [2+]  40 [3+]  30 [4+]  16 [5+]   0
Hits/KSLOC@level+ = [0+] 67.1453 [1+] 29.5608 [2+] 16.8919 [3+] 12.6689 [4+] 6.75676 [5+]   0
Dot directories skipped = 2 (--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.