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/gkrelltop-2.2.13/gkrelltop.h
Examining data/gkrelltop-2.2.13/gkrelltopd.c
Examining data/gkrelltop-2.2.13/ttest.c
Examining data/gkrelltop-2.2.13/support.h
Examining data/gkrelltop-2.2.13/gkrelltop.c
Examining data/gkrelltop-2.2.13/top_three.c

FINAL RESULTS:

data/gkrelltop-2.2.13/gkrelltop.c:777:9:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
        sscanf(config_data, "%s", s_exclusion);
data/gkrelltop-2.2.13/top_three.c:28:21:  [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.
#error No operating system selected
data/gkrelltop-2.2.13/top_three.c:108:12:  [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).
    return strcpy((char *) gktop_malloc(strlen(s) + 1), s);
data/gkrelltop-2.2.13/top_three.c:252:5:  [4] (format) snprintf:
  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.
    snprintf(filename, sizeof(filename), PROCFS_TEMPLATE, process->pid);
data/gkrelltop-2.2.13/top_three.c:266:10:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
    rc = sscanf(line,
data/gkrelltop-2.2.13/top_three.c:285:13:  [4] (format) snprintf:
  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.
            snprintf(filename, sizeof(filename), 
data/gkrelltop-2.2.13/top_three.c:329:10:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
    rc = sscanf(line, "%s %*s %*s %*s %*s %*s %*s %*s %d,%d %d,%d",
data/gkrelltop-2.2.13/top_three.c:469:51:  [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.
    sscanf(line, "%*s %d %d %d %d", &cpu, &nice, &system, &idle);
data/gkrelltop-2.2.13/top_three.c:557:9:  [4] (format) snprintf:
  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.
        snprintf(filename,sizeof(filename), PROCFS_IO_TEMPLATE, p->pid);
data/gkrelltop-2.2.13/gkrelltop.c:141:22:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        cache_ntop = atoi(item);
data/gkrelltop-2.2.13/top_three.c:237: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 line[BUFFER_LEN] = {0};
data/gkrelltop-2.2.13/top_three.c:238: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 filename[BUFFER_LEN] = {0};
data/gkrelltop-2.2.13/top_three.c:239: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 procname[BUFFER_LEN] = {0};
data/gkrelltop-2.2.13/top_three.c:254:14:  [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).
    int ps = open(filename, O_RDONLY);
data/gkrelltop-2.2.13/top_three.c:277: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 deparenthesised_name[BUFFER_LEN] = {0};
data/gkrelltop-2.2.13/top_three.c:288:18:  [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).
            ps = open(filename, O_RDONLY);
data/gkrelltop-2.2.13/top_three.c:458: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 line[BUFFER_LEN] = { '\0' };
data/gkrelltop-2.2.13/top_three.c:464:14:  [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).
    int ps = open("/proc/stat", O_RDONLY);
data/gkrelltop-2.2.13/top_three.c:501: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 line[512];
data/gkrelltop-2.2.13/top_three.c:506:10:  [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).
    ps = open("/proc/meminfo", O_RDONLY);
data/gkrelltop-2.2.13/top_three.c:515:16:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        return atoi(total+9)-atoi(free+9);
data/gkrelltop-2.2.13/top_three.c:515:30:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        return atoi(total+9)-atoi(free+9);
data/gkrelltop-2.2.13/top_three.c:552: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 line[BUFFER_LEN], filename[BUFFER_LEN];
data/gkrelltop-2.2.13/top_three.c:559:14:  [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).
        ps = open(filename, O_RDONLY);
data/gkrelltop-2.2.13/ttest.c:49: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 str [256];
data/gkrelltop-2.2.13/gkrelltop.c:136:9:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
    if (sscanf(line, "%31s %127[^\n]", which, item) != 2)
data/gkrelltop-2.2.13/gkrelltop.c:152:14:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
          && sscanf(item, "%d %127s %d %f", &n, name, &pid, &amount) == 4
data/gkrelltop-2.2.13/gkrelltop.c:334: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(g_tooltip_text,g_pluginModeText[pluginMode],
data/gkrelltop-2.2.13/gkrelltop.c:335:41:  [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).
                 sizeof(g_tooltip_text)-strlen(g_tooltip_text));
data/gkrelltop-2.2.13/gkrelltop.c:369:13:  [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(g_tooltip_text,tmp,sizeof(g_tooltip_text)-strlen(g_tooltip_text));
data/gkrelltop-2.2.13/gkrelltop.c:369:63:  [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).
            strncat(g_tooltip_text,tmp,sizeof(g_tooltip_text)-strlen(g_tooltip_text));
data/gkrelltop-2.2.13/gkrelltop.c:634:9:  [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(s_exclusion) > 0)
data/gkrelltop-2.2.13/gkrelltop.c:677:9:  [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(s_exclusion) > 0 ) {
data/gkrelltop-2.2.13/gkrelltop.c:756:14:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
    if ((n = sscanf(config_line,"%31s %[^\n]",config_keyword,config_data)) != 2)
data/gkrelltop-2.2.13/top_three.c:108:41:  [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 strcpy((char *) gktop_malloc(strlen(s) + 1), s);
data/gkrelltop-2.2.13/top_three.c:259:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int rc = read(ps, line, sizeof(line));
data/gkrelltop-2.2.13/top_three.c:295:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            endl = read(ps, line, sizeof(line));
data/gkrelltop-2.2.13/top_three.c:465:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int rc = read(ps, line, sizeof(line));
data/gkrelltop-2.2.13/top_three.c:507:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    rc = read(ps, line, sizeof(line));
data/gkrelltop-2.2.13/top_three.c:569:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        rc = read(ps, line, sizeof(line)); 
data/gkrelltop-2.2.13/ttest.c:145:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(SLEEPLENGTH); /* microsleep in microseeconds */

ANALYSIS SUMMARY:

Hits = 41
Lines analyzed = 1921 in approximately 0.07 seconds (26160 lines/second)
Physical Source Lines of Code (SLOC) = 1271
Hits@level = [0]  41 [1]  16 [2]  16 [3]   0 [4]   9 [5]   0
Hits@level+ = [0+]  82 [1+]  41 [2+]  25 [3+]   9 [4+]   9 [5+]   0
Hits/KSLOC@level+ = [0+] 64.5161 [1+] 32.2581 [2+] 19.6696 [3+] 7.08104 [4+] 7.08104 [5+]   0
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.