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/xbattbar-1.4.9/xbattbar-check-apm.c
Examining data/xbattbar-1.4.9/xbattbar.c

FINAL RESULTS:

data/xbattbar-1.4.9/xbattbar-check-apm.c:246:3:  [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( buf, "%s %d.%d %x %x %x %x %d%% %d %d\n",
data/xbattbar-1.4.9/xbattbar.c:369:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(diagmsg,
data/xbattbar-1.4.9/xbattbar.c:607:3:  [4] (shell) execvp:
  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.
		execvp(EXTERNAL_CHECK, argv);
data/xbattbar-1.4.9/xbattbar.c:242:16:  [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.
  while ((ch = getopt(argc, argv, "at:f:hI:i:O:o:p:vs:cr")) != -1)
data/xbattbar-1.4.9/xbattbar-check-apm.c:59:13:  [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).
  if ((fd = open(_PATH_DEVAPM, O_RDONLY)) < 0) {
data/xbattbar-1.4.9/xbattbar-check-apm.c:102:13:  [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).
  if ((fd = open(APMDEV21, O_RDWR)) == -1 &&
data/xbattbar-1.4.9/xbattbar-check-apm.c:103:13:  [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).
      (fd = open(APMDEV22, O_RDWR)) == -1) {
data/xbattbar-1.4.9/xbattbar-check-apm.c:165: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).
       if ((fd = open(_PATH_APM_NORMAL, O_RDONLY)) == -1) {
data/xbattbar-1.4.9/xbattbar-check-apm.c:213: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 driver_version[10];
data/xbattbar-1.4.9/xbattbar-check-apm.c:232: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[100];
data/xbattbar-1.4.9/xbattbar-check-apm.c:236:14:  [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 ( (pt = fopen( APM_PROC, "r" )) == NULL) {
data/xbattbar-1.4.9/xbattbar.c:262:18:  [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).
      bi_thick = atoi(optarg);
data/xbattbar-1.4.9/xbattbar.c:279:21:  [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).
      bi_interval = atoi(optarg);
data/xbattbar-1.4.9/xbattbar.c:366: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 diagmsg[64];
data/xbattbar-1.4.9/xbattbar.c:521:2:  [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 buffer[TEMP_BUFFER_SIZE];
data/xbattbar-1.4.9/xbattbar.c:373:37:  [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).
  pixw = XTextWidth(fontp, diagmsg, strlen(diagmsg));
data/xbattbar-1.4.9/xbattbar.c:394: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).
             diagmsg, strlen(diagmsg));
data/xbattbar-1.4.9/xbattbar.c:492:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	int rd = read(pipe, buffer, TEMP_BUFFER_SIZE - 1);

ANALYSIS SUMMARY:

Hits = 18
Lines analyzed = 900 in approximately 0.03 seconds (28931 lines/second)
Physical Source Lines of Code (SLOC) = 665
Hits@level = [0]  23 [1]   3 [2]  11 [3]   1 [4]   3 [5]   0
Hits@level+ = [0+]  41 [1+]  18 [2+]  15 [3+]   4 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 61.6541 [1+] 27.0677 [2+] 22.5564 [3+] 6.01504 [4+] 4.51128 [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.