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/xfce4-battery-plugin-1.1.3/panel-plugin/battery.c
Examining data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.h
Examining data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c

FINAL RESULTS:

data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:111: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(fmt, (char *)(buf + sizeof(u_int)));
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:218:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(typepath, "/sys/class/power_supply/%s/type",name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:228:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(batteries[batt_count], "/sys/class/power_supply/%s", name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:237:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(sysfsacdir, "/sys/class/power_supply/%s", name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:327:5:  [4] (buffer) fscanf:
  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.
    fscanf(f,"%s",buf2);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:349:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(onlinefilepath, "%s/online", sysfsacdir);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:418:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:423:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:429:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:441:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:542:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:560:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:567:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:577:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf,"%s/%s",batteries[battery], name);
data/xfce4-battery-plugin-1.1.3/panel-plugin/battery.c:194: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).
    fd = open(APMDEVICE, O_RDONLY);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:65:8:  [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.
static char batteries[MAXBATT][128];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:68:8:  [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.
static char sysfsacdir[280];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:100: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(qoid + 2, oid, len * sizeof(int));
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:121: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 name[BUFSIZ], *fmt, *sep;
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:128: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(qoid + 2, oid, nlen * sizeof(int));
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:197: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 typepath[300];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:198: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 tmptype[8];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:219:26:  [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 (!(typefile = fopen(typepath, "r")))
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:264: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).
    fd = fopen(globbuf.gl_pathv[0], mode);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:278:12:  [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.
    static char buf[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:280: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 fmt[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:305:9:  [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).
    f = fopen(filename,"r");
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:321:9:  [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).
    f = fopen(filename,"r");
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:336: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 onlinefilepath[300];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:364:12:  [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.
    static char buf[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:365: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 fmt[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:461:12:  [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.
    static char buf[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:464: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 fmt[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:492: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).
    acpifd = open(ACPIDEV, O_RDONLY);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:595:12:  [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.
    static char buf[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:596: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 fmt[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:643: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).
    acpifd = open(ACPIDEV, O_RDONLY);
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:675: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[256];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:678:13:  [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 ((fp=fopen(proc_fan_status, "r")) != NULL) {
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:706:12:  [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.
    static char *p,*p2,line[256];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:716:9:  [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(p2, " C");
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:723:12:  [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.
    static char buf[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:724: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 fmt[BUFSIZ];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.h:80: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 buf[512];
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.h:81: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 buf2[512];
data/xfce4-battery-plugin-1.1.3/panel-plugin/battery.c:434:66:  [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).
    gtk_css_provider_load_from_data (battmon->css_provider, css, strlen(css), NULL);
data/xfce4-battery-plugin-1.1.3/panel-plugin/battery.c:456: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).
                    !strlen(battmon->options.command_on_critical)) goto do_critical_warn;
data/xfce4-battery-plugin-1.1.3/panel-plugin/battery.c:475: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).
                    !strlen(battmon->options.command_on_low)) goto do_low_warn;
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:83:40:  [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).
    i = sysctl(oid, 2, oidp, &j, name, strlen(name));
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:681: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(line) && strstr(line,"1"))
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:694: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(line) && strstr(line,"off"))
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:714: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(p) <= 3) return NULL;
data/xfce4-battery-plugin-1.1.3/panel-plugin/libacpi.c:715: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).
        p2 = p + strlen(p) - 3;

ANALYSIS SUMMARY:

Hits = 53
Lines analyzed = 2319 in approximately 0.07 seconds (31118 lines/second)
Physical Source Lines of Code (SLOC) = 1794
Hits@level = [0]  12 [1]   8 [2]  31 [3]   0 [4]  14 [5]   0
Hits@level+ = [0+]  65 [1+]  53 [2+]  45 [3+]  14 [4+]  14 [5+]   0
Hits/KSLOC@level+ = [0+] 36.2319 [1+] 29.5429 [2+] 25.0836 [3+] 7.80379 [4+] 7.80379 [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.