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/ukui-power-manager-3.0.0/ukui-power-manager-tray/mainwindow.h Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/customtype.h Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/remainlabel.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/device.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/enginedevice.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/customstyle.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/device_form.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/enginedevice.h Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/customstyle.h Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/engine_common.h Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/device.h Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/main.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/mainwindow.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/customtype.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/remainlabel.h Examining data/ukui-power-manager-3.0.0/ukui-power-manager-tray/device_form.h Examining data/ukui-power-manager-3.0.0/src/gpm-backlight.c Examining data/ukui-power-manager-3.0.0/src/msd-osd-window.c Examining data/ukui-power-manager-3.0.0/src/gpm-upower.h Examining data/ukui-power-manager-3.0.0/src/gpm-common.h Examining data/ukui-power-manager-3.0.0/src/egg-array-float.h Examining data/ukui-power-manager-3.0.0/src/egg-discrete.c Examining data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c Examining data/ukui-power-manager-3.0.0/src/gpm-screensaver.c Examining data/ukui-power-manager-3.0.0/src/gpm-prefs-core.c Examining data/ukui-power-manager-3.0.0/src/gpm-brightness.h Examining data/ukui-power-manager-3.0.0/src/gpm-load.h Examining data/ukui-power-manager-3.0.0/src/egg-color.c Examining data/ukui-power-manager-3.0.0/src/egg-idletime.h Examining data/ukui-power-manager-3.0.0/src/gpm-engine.h Examining data/ukui-power-manager-3.0.0/src/gpm-tray-icon.h Examining data/ukui-power-manager-3.0.0/src/gpm-dpms.c Examining data/ukui-power-manager-3.0.0/src/gpm-control.h Examining data/ukui-power-manager-3.0.0/src/egg-test.c Examining data/ukui-power-manager-3.0.0/src/egg-console-kit.h Examining data/ukui-power-manager-3.0.0/src/egg-precision.c Examining data/ukui-power-manager-3.0.0/src/gpm-button.h Examining data/ukui-power-manager-3.0.0/src/gpm-manager.c Examining data/ukui-power-manager-3.0.0/src/gpm-phone.h Examining data/ukui-power-manager-3.0.0/src/gpm-main.c Examining data/ukui-power-manager-3.0.0/src/egg-color.h Examining data/ukui-power-manager-3.0.0/src/egg-test.h Examining data/ukui-power-manager-3.0.0/src/gpm-self-test.c Examining data/ukui-power-manager-3.0.0/src/gpm-networkmanager.h Examining data/ukui-power-manager-3.0.0/src/egg-console-kit.c Examining data/ukui-power-manager-3.0.0/src/egg-idletime.c Examining data/ukui-power-manager-3.0.0/src/gpm-backlight.h Examining data/ukui-power-manager-3.0.0/src/gpm-idle.h Examining data/ukui-power-manager-3.0.0/src/gpm-networkmanager.c Examining data/ukui-power-manager-3.0.0/src/gpm-manager.h Examining data/ukui-power-manager-3.0.0/src/gpm-session.h Examining data/ukui-power-manager-3.0.0/src/gpm-kbd-backlight.h Examining data/ukui-power-manager-3.0.0/src/gpm-brightness.c Examining data/ukui-power-manager-3.0.0/src/egg-array-float.c Examining data/ukui-power-manager-3.0.0/src/gsd-media-keys-window.c Examining data/ukui-power-manager-3.0.0/src/egg-debug.h Examining data/ukui-power-manager-3.0.0/src/gpm-load.c Examining data/ukui-power-manager-3.0.0/src/gpm-idle.c Examining data/ukui-power-manager-3.0.0/src/gpm-button.c Examining data/ukui-power-manager-3.0.0/src/gpm-control.c Examining data/ukui-power-manager-3.0.0/src/gpm-icon-names.h Examining data/ukui-power-manager-3.0.0/src/gpm-kbd-backlight.c Examining data/ukui-power-manager-3.0.0/src/gpm-phone.c Examining data/ukui-power-manager-3.0.0/src/gpm-prefs.c Examining data/ukui-power-manager-3.0.0/src/msd-osd-window.h Examining data/ukui-power-manager-3.0.0/src/egg-discrete.h Examining data/ukui-power-manager-3.0.0/src/egg-debug.c Examining data/ukui-power-manager-3.0.0/src/gpm-upower.c Examining data/ukui-power-manager-3.0.0/src/gpm-backlight-helper.c Examining data/ukui-power-manager-3.0.0/src/gpm-session.c Examining data/ukui-power-manager-3.0.0/src/gpm-prefs-core.h Examining data/ukui-power-manager-3.0.0/src/egg-precision.h Examining data/ukui-power-manager-3.0.0/src/gpm-dpms.h Examining data/ukui-power-manager-3.0.0/src/gsd-media-keys-window.h Examining data/ukui-power-manager-3.0.0/src/gpm-engine.c Examining data/ukui-power-manager-3.0.0/src/gpm-common.c Examining data/ukui-power-manager-3.0.0/src/gpm-screensaver.h Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/titlewidget.h Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/titlewidget.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/customtype.h Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/eggunique.h Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/statistics_common.h Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/device.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/device.h Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/main.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/customtype.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/eggunique.cpp Examining data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.h FINAL RESULTS: data/ukui-power-manager-3.0.0/src/egg-debug.h:71:57: [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. const gchar *format, ...) __attribute__((format (printf,4,5))); data/ukui-power-manager-3.0.0/src/egg-debug.h:75:57: [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. const gchar *format, ...) __attribute__((format (printf,4,5))); data/ukui-power-manager-3.0.0/src/egg-debug.h:79:73: [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. const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5))); data/ukui-power-manager-3.0.0/src/gpm-common.h:32:27: [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. #define LOGIND_RUNNING() (access("/run/systemd/seats/", F_OK) >= 0) data/ukui-power-manager-3.0.0/src/gpm-load.c:186:8: [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. len = sscanf (str, "%s %lu %lu %lu %lu", tmp, data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:518:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(color_hex,"\#%s%s%s",color_hex_red,color_hex_green,color_hex_blue); data/ukui-power-manager-3.0.0/ukui-power-manager-tray/enginedevice.cpp:930:20: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. result.sprintf ("gpm-%s-missing", prefix.toStdString().c_str()); data/ukui-power-manager-3.0.0/ukui-power-manager-tray/enginedevice.cpp:933:20: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. result.sprintf ("gpm-%s-100", prefix.toStdString().c_str()); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1038:17: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%9.1fw",starty+i*(stopy-starty)/10.0); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1060:17: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("%d%%",i*10); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1614:18: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. text.sprintf("%dd",days); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1617:18: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. text.sprintf("%.1fd",days+hours*1.0/24); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1622:18: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. text.sprintf("%dh",hours); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1625:18: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. text.sprintf("%.1fh",(hours+minutes*1.0/60)); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1630:18: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. text.sprintf("%dm",minutes); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1632:18: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. text.sprintf("%dm%ds",minutes,seconds); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:1636:14: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. text.sprintf("%ds",seconds); data/ukui-power-manager-3.0.0/src/gpm-main.c:244:62: [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. gpm_session_register_client (session, "ukui-power-manager", getenv ("DESKTOP_AUTOSTART_ID")); data/ukui-power-manager-3.0.0/src/gpm-backlight-helper.c:118:7: [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 (filename, O_WRONLY); data/ukui-power-manager-3.0.0/src/gpm-brightness.c:216:3: [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 (cur, prop, sizeof (guint)); data/ukui-power-manager-3.0.0/src/gpm-load.c:169: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 tmp[5]; data/ukui-power-manager-3.0.0/src/gpm-load.c:170: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 str[80]; data/ukui-power-manager-3.0.0/src/gpm-load.c:176:7: [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("/proc/stat", "r"); data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:498: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 color_hex[10]={0}; data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:499: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 color_hex_red[4]={0}; data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:500: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 color_hex_green[4]={0}; data/ukui-power-manager-3.0.0/src/gpm-tray-icon.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 color_hex_blue[4]={0}; data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:504:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(color_hex_red,"0%x",color.red/257); data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:506:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(color_hex_red,"%x",color.red/257); data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:509:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(color_hex_green,"0%x",color.green/257); data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:511:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(color_hex_green,"%x",color.green/257); data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:514:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(color_hex_blue,"0%x",color.blue/257); data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:516:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(color_hex_blue,"%x",color.blue/257); data/ukui-power-manager-3.0.0/ukui-power-manager-tray/device_form.cpp:311:34: [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(absolute_file.open(QIODevice::ReadOnly | QIODevice::Text)) data/ukui-power-manager-3.0.0/ukui-power-manager-tray/main.cpp:91: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). file.open(QFile::ReadOnly); data/ukui-power-manager-3.0.0/ukui-power-statistics/titlewidget.cpp: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). file.open(QFile::ReadOnly); data/ukui-power-manager-3.0.0/ukui-power-statistics/ukpm_widget.cpp:59: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). file.open(QFile::ReadOnly); data/ukui-power-manager-3.0.0/src/gpm-backlight-helper.c:127:11: [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 (text); data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:327: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 ((vendor != NULL && strlen(vendor) != 0) && (model != NULL && strlen(model) != 0)) { data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:327:68: [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 ((vendor != NULL && strlen(vendor) != 0) && (model != NULL && strlen(model) != 0)) { data/ukui-power-manager-3.0.0/src/gpm-tray-icon.c:861: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). color_spec[strlen(color_spec)] = *needle; ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 27462 in approximately 0.69 seconds (39829 lines/second) Physical Source Lines of Code (SLOC) = 18375 Hits@level = [0] 9 [1] 4 [2] 19 [3] 1 [4] 17 [5] 0 Hits@level+ = [0+] 50 [1+] 41 [2+] 37 [3+] 18 [4+] 17 [5+] 0 Hits/KSLOC@level+ = [0+] 2.72109 [1+] 2.23129 [2+] 2.01361 [3+] 0.979592 [4+] 0.92517 [5+] 0 Dot directories skipped = 2 (--followdotdir overrides) Suppressed hits = 2 (use --neverignore to show them) 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.