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/psensor-1.1.5/src/cfg.c Examining data/psensor-1.1.5/src/cfg.h Examining data/psensor-1.1.5/src/graph.c Examining data/psensor-1.1.5/src/graph.h Examining data/psensor-1.1.5/src/lib/amd.c Examining data/psensor-1.1.5/src/lib/amd.h Examining data/psensor-1.1.5/src/lib/bool.h Examining data/psensor-1.1.5/src/lib/color.c Examining data/psensor-1.1.5/src/lib/color.h Examining data/psensor-1.1.5/src/lib/hdd.h Examining data/psensor-1.1.5/src/lib/hdd_atasmart.c Examining data/psensor-1.1.5/src/lib/hdd_hddtemp.c Examining data/psensor-1.1.5/src/lib/lmsensor.c Examining data/psensor-1.1.5/src/lib/lmsensor.h Examining data/psensor-1.1.5/src/lib/measure.c Examining data/psensor-1.1.5/src/lib/measure.h Examining data/psensor-1.1.5/src/lib/nvidia.c Examining data/psensor-1.1.5/src/lib/nvidia.h Examining data/psensor-1.1.5/src/lib/pgtop2.c Examining data/psensor-1.1.5/src/lib/pgtop2.h Examining data/psensor-1.1.5/src/lib/pio.c Examining data/psensor-1.1.5/src/lib/pio.h Examining data/psensor-1.1.5/src/lib/plog.c Examining data/psensor-1.1.5/src/lib/plog.h Examining data/psensor-1.1.5/src/lib/pmutex.c Examining data/psensor-1.1.5/src/lib/pmutex.h Examining data/psensor-1.1.5/src/lib/psensor.c Examining data/psensor-1.1.5/src/lib/psensor.h Examining data/psensor-1.1.5/src/lib/psensor_json.c Examining data/psensor-1.1.5/src/lib/psensor_json.h Examining data/psensor-1.1.5/src/lib/ptime.c Examining data/psensor-1.1.5/src/lib/ptime.h Examining data/psensor-1.1.5/src/lib/pudisks2.c Examining data/psensor-1.1.5/src/lib/pudisks2.h Examining data/psensor-1.1.5/src/lib/slog.c Examining data/psensor-1.1.5/src/lib/slog.h Examining data/psensor-1.1.5/src/lib/temperature.c Examining data/psensor-1.1.5/src/lib/temperature.h Examining data/psensor-1.1.5/src/lib/url.c Examining data/psensor-1.1.5/src/lib/url.h Examining data/psensor-1.1.5/src/main.c Examining data/psensor-1.1.5/src/notify_cmd.c Examining data/psensor-1.1.5/src/notify_cmd.h Examining data/psensor-1.1.5/src/pxdg.c Examining data/psensor-1.1.5/src/pxdg.h Examining data/psensor-1.1.5/src/rsensor.h Examining data/psensor-1.1.5/src/server/server.h Examining data/psensor-1.1.5/src/server/sysinfo.c Examining data/psensor-1.1.5/src/server/sysinfo.h Examining data/psensor-1.1.5/src/server/server.c Examining data/psensor-1.1.5/src/ui.c Examining data/psensor-1.1.5/src/ui.h Examining data/psensor-1.1.5/src/ui_appindicator.c Examining data/psensor-1.1.5/src/ui_appindicator.h Examining data/psensor-1.1.5/src/ui_color.c Examining data/psensor-1.1.5/src/ui_color.h Examining data/psensor-1.1.5/src/ui_graph.c Examining data/psensor-1.1.5/src/ui_graph.h Examining data/psensor-1.1.5/src/ui_notify.c Examining data/psensor-1.1.5/src/ui_notify.h Examining data/psensor-1.1.5/src/ui_pref.c Examining data/psensor-1.1.5/src/ui_pref.h Examining data/psensor-1.1.5/src/ui_sensorlist.c Examining data/psensor-1.1.5/src/ui_sensorlist.h Examining data/psensor-1.1.5/src/ui_sensorpref.c Examining data/psensor-1.1.5/src/ui_sensorpref.h Examining data/psensor-1.1.5/src/ui_status.c Examining data/psensor-1.1.5/src/ui_status.h Examining data/psensor-1.1.5/src/ui_unity.c Examining data/psensor-1.1.5/src/ui_unity.h Examining data/psensor-1.1.5/src/rsensor.c Examining data/psensor-1.1.5/tests/test_io_dir_list.c Examining data/psensor-1.1.5/tests/test_psensor_type_to_unit_str.c Examining data/psensor-1.1.5/tests/test_psensor_value_to_str.c Examining data/psensor-1.1.5/tests/test_url_encode.c Examining data/psensor-1.1.5/tests/test_url_normalize.c FINAL RESULTS: data/psensor-1.1.5/src/lib/amd.c:141:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(sid, "amd %s", name); data/psensor-1.1.5/src/lib/hdd_atasmart.c:132:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(id, "%s %s", PROVIDER_NAME, *tmp); data/psensor-1.1.5/src/lib/hdd_hddtemp.c:203:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(id, "%s %s", PROVIDER_NAME, info.name); data/psensor-1.1.5/src/lib/lmsensor.c:163:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(id, "%s %s %s", PROVIDER_NAME, name, label); data/psensor-1.1.5/src/lib/nvidia.c:273:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(name, "%s %s %s", pname, strnid, stype); data/psensor-1.1.5/src/lib/nvidia.c:276:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(sid, "%s %s", PROVIDER_NAME, name); data/psensor-1.1.5/src/lib/pio.c:282:3: [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(ret, ndir); data/psensor-1.1.5/src/lib/pio.c:284:3: [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, path); data/psensor-1.1.5/src/lib/plog.c:67:2: [4] (format) vsnprintf: 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. vsnprintf(buffer, LOG_BUFFER, fmt, ap); data/psensor-1.1.5/src/lib/psensor.c:229:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%.0f%s", value, unit); data/psensor-1.1.5/src/lib/psensor_json.c:149:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(url, "%s/%s", sensors_url, eid); data/psensor-1.1.5/src/lib/slog.c:76:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(dir, "%s/%s", home, ".psensor"); data/psensor-1.1.5/src/lib/slog.c:80:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s", dir, DEFAULT_FILENAME); data/psensor-1.1.5/src/main.c:367:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s", dir, "log"); data/psensor-1.1.5/src/notify_cmd.c:45:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cmd, "%s \"%s\" %s", script, s->id, v); data/psensor-1.1.5/src/notify_cmd.c:49: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(cmd); data/psensor-1.1.5/src/rsensor.c:67:2: [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(ret, nurl); data/psensor-1.1.5/src/rsensor.c:68:2: [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, URL_BASE_API_1_1_SENSORS); data/psensor-1.1.5/src/server/server.c:141:2: [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(res, www_dir); data/psensor-1.1.5/src/server/server.c:142:2: [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(res, p); data/psensor-1.1.5/src/ui_appindicator.c:194:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp, "%s %s", label, str); data/psensor-1.1.5/src/ui_appindicator.c:214:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp, "%sW%s", guide, str); data/psensor-1.1.5/src/ui_notify.c:73:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(body, "%s : %s", sensor->name, svalue); data/psensor-1.1.5/src/cfg.c:502:10: [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. home = getenv("HOME"); data/psensor-1.1.5/src/lib/slog.c:72:9: [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. home = getenv("HOME"); data/psensor-1.1.5/src/main.c:536:17: [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 ((optc = getopt_long(argc, argv, "vhd:u:n", long_options, data/psensor-1.1.5/src/server/server.c:259:11: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. rpath = realpath(fpath, NULL); data/psensor-1.1.5/src/server/server.c:359:17: [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 ((optc = getopt_long(argc, data/psensor-1.1.5/src/server/server.c:367:27: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. server_data.www_dir = realpath(optarg, NULL); data/psensor-1.1.5/src/server/server.c:407:25: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. server_data.www_dir = realpath(DEFAULT_WWW_DIR, NULL); data/psensor-1.1.5/src/lib/amd.c:114: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 name[200]; data/psensor-1.1.5/src/lib/amd.c:123:3: [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(name, "AMD GPU%d Fan", id); data/psensor-1.1.5/src/lib/amd.c:129:3: [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(name, "AMD GPU%d Temperature", id); data/psensor-1.1.5/src/lib/amd.c:135:3: [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(name, "AMD GPU%d Usage", id); data/psensor-1.1.5/src/lib/color.c:66: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/psensor-1.1.5/src/lib/color.c:93:2: [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(str, "#%.4x%.4x%.4x", data/psensor-1.1.5/src/lib/hdd_atasmart.c:79:6: [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). f = open(dname, O_RDONLY|O_NOCTTY|O_NONBLOCK|O_CLOEXEC); data/psensor-1.1.5/src/lib/hdd_hddtemp.c:159:9: [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). temp = atoi(c); data/psensor-1.1.5/src/lib/lmsensor.c:122: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 name[200]; data/psensor-1.1.5/src/lib/measure.c:47:2: [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(dst, src, sizeof(struct measure)); data/psensor-1.1.5/src/lib/nvidia.c:120:8: [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). v = atoi(strv); data/psensor-1.1.5/src/lib/pio.c:90:2: [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(result + 1, paths, n * sizeof(void *)); data/psensor-1.1.5/src/lib/pio.c:166: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). FILE *fp = fopen(fpath, "rb"); data/psensor-1.1.5/src/lib/pio.c:194: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). fp = fopen(path, "rb"); data/psensor-1.1.5/src/lib/pio.c:245: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). fsrc = fopen(src, "r"); data/psensor-1.1.5/src/lib/pio.c:248: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). fdst = fopen(dst, "w+"); data/psensor-1.1.5/src/lib/plog.c:40: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). file = fopen(path, "a"); data/psensor-1.1.5/src/lib/plog.c:60: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[1 + LOG_BUFFER]; data/psensor-1.1.5/src/lib/psensor.c:169: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(result, sensors, size * sizeof(struct psensor *)); data/psensor-1.1.5/src/lib/slog.c:102: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). file = fopen(lpath, "a"); data/psensor-1.1.5/src/main.c:267: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. const char *default_colors[27] = { data/psensor-1.1.5/src/main.c:550: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). log_level = atoi(optarg); data/psensor-1.1.5/src/rsensor.c:51:2: [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(&(mem->data[mem->len]), buffer, realsize); data/psensor-1.1.5/src/server/server.c:221: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). file = fopen(fpath, "rb"); data/psensor-1.1.5/src/server/server.c:371:12: [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). port = atoi(optarg); data/psensor-1.1.5/src/server/server.c:380: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). log_level = atoi(optarg); data/psensor-1.1.5/src/server/server.c:392: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). slog_interval = atoi(optarg); data/psensor-1.1.5/src/cfg.c:178:14: [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 (str && !strlen(str)) { data/psensor-1.1.5/src/cfg.c:188: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 (str && strlen(str) > 0) data/psensor-1.1.5/src/lib/amd.c:140:15: [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). sid = malloc(strlen("amd") + 1 + strlen(name) + 1); data/psensor-1.1.5/src/lib/amd.c:140:35: [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). sid = malloc(strlen("amd") + 1 + strlen(name) + 1); data/psensor-1.1.5/src/lib/color.c:51:10: [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 n = strlen(str); data/psensor-1.1.5/src/lib/color.c:72:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tmp, str + 1, 4); data/psensor-1.1.5/src/lib/color.c:76:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tmp, str + 5, 4); data/psensor-1.1.5/src/lib/color.c:80:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tmp, str + 9, 4); data/psensor-1.1.5/src/lib/hdd_atasmart.c:46: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). return strlen(p) == 8 && !strncmp(p, "/dev/sd", 7); data/psensor-1.1.5/src/lib/hdd_atasmart.c:128:16: [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). id = malloc(strlen(PROVIDER_NAME) data/psensor-1.1.5/src/lib/hdd_atasmart.c:130: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). + strlen(*tmp) data/psensor-1.1.5/src/lib/hdd_hddtemp.c:80:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(sockfd, data/psensor-1.1.5/src/lib/hdd_hddtemp.c:135:17: [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 (!string || strlen(string) <= 5 /* at least 5 pipes */ data/psensor-1.1.5/src/lib/hdd_hddtemp.c:169:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info->name, string + 1, idx_name_n); data/psensor-1.1.5/src/lib/hdd_hddtemp.c:202:15: [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). id = malloc(strlen(PROVIDER_NAME) + 1 + strlen(info.name) + 1); data/psensor-1.1.5/src/lib/hdd_hddtemp.c:202:43: [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). id = malloc(strlen(PROVIDER_NAME) + 1 + strlen(info.name) + 1); data/psensor-1.1.5/src/lib/lmsensor.c:157:14: [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). id = malloc(strlen(PROVIDER_NAME) data/psensor-1.1.5/src/lib/lmsensor.c:159: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). + strlen(name) data/psensor-1.1.5/src/lib/lmsensor.c:161: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). + strlen(label) data/psensor-1.1.5/src/lib/nvidia.c:271:6: [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). n = strlen(pname) + 1 + strlen(strnid) + 1 + strlen(stype) + 1; data/psensor-1.1.5/src/lib/nvidia.c:271: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). n = strlen(pname) + 1 + strlen(strnid) + 1 + strlen(stype) + 1; data/psensor-1.1.5/src/lib/nvidia.c:271:47: [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). n = strlen(pname) + 1 + strlen(strnid) + 1 + strlen(stype) + 1; data/psensor-1.1.5/src/lib/nvidia.c:275:15: [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). sid = malloc(strlen(PROVIDER_NAME) + 1 + strlen(name) + 1); data/psensor-1.1.5/src/lib/nvidia.c:275:43: [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). sid = malloc(strlen(PROVIDER_NAME) + 1 + strlen(name) + 1); data/psensor-1.1.5/src/lib/pio.c:71:17: [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 (!dpath || !strlen(dpath)) data/psensor-1.1.5/src/lib/pio.c:76:6: [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). n = strlen(npath); data/psensor-1.1.5/src/lib/pio.c:271: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 (!ndir && (!path || !strlen(path))) data/psensor-1.1.5/src/lib/pio.c:277: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). } else if (!path || !strlen(path)) { data/psensor-1.1.5/src/lib/pio.c:281:16: [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). ret = malloc(strlen(ndir) + 1 + strlen(path) + 1); data/psensor-1.1.5/src/lib/pio.c:281:35: [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). ret = malloc(strlen(ndir) + 1 + strlen(path) + 1); data/psensor-1.1.5/src/lib/pio.c:283:3: [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/psensor-1.1.5/src/lib/pio.c:300:15: [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). dir = malloc(strlen(dirs) + 1); data/psensor-1.1.5/src/lib/pio.c:305:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dir, dirs, i); data/psensor-1.1.5/src/lib/psensor_json.c:148:15: [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). url = malloc(strlen(sensors_url) + 1 + strlen(eid) + 1); data/psensor-1.1.5/src/lib/psensor_json.c:148: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). url = malloc(strlen(sensors_url) + 1 + strlen(eid) + 1); data/psensor-1.1.5/src/lib/slog.c:75:16: [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). dir = malloc(strlen(home)+1+strlen(".psensor")+1); data/psensor-1.1.5/src/lib/slog.c:75: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). dir = malloc(strlen(home)+1+strlen(".psensor")+1); data/psensor-1.1.5/src/lib/slog.c:79:17: [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). path = malloc(strlen(dir)+1+strlen(DEFAULT_FILENAME)+1); data/psensor-1.1.5/src/lib/slog.c:79: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). path = malloc(strlen(dir)+1+strlen(DEFAULT_FILENAME)+1); data/psensor-1.1.5/src/lib/url.c:32:10: [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 n = strlen(url); data/psensor-1.1.5/src/lib/url.c:54:15: [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). buf = malloc(strlen(str) * 3 + 1); data/psensor-1.1.5/src/main.c:366:16: [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). path = malloc(strlen(dir)+1+strlen("log")+1); data/psensor-1.1.5/src/main.c:366:30: [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). path = malloc(strlen(dir)+1+strlen("log")+1); data/psensor-1.1.5/src/notify_cmd.c:36:16: [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). cmd = malloc(strlen(script) data/psensor-1.1.5/src/notify_cmd.c:39: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). + strlen(s->id) data/psensor-1.1.5/src/notify_cmd.c:42: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). + strlen(v) data/psensor-1.1.5/src/rsensor.c:64:6: [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). n = strlen(nurl) + strlen(URL_BASE_API_1_1_SENSORS) + 1; data/psensor-1.1.5/src/rsensor.c:64: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). n = strlen(nurl) + strlen(URL_BASE_API_1_1_SENSORS) + 1; data/psensor-1.1.5/src/server/server.c:134:7: [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(url) || !strcmp(url, ".") || !strcmp(url, "/")) data/psensor-1.1.5/src/server/server.c:139:15: [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). res = malloc(strlen(www_dir)+strlen(p)+1); data/psensor-1.1.5/src/server/server.c:139: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). res = malloc(strlen(www_dir)+strlen(p)+1); data/psensor-1.1.5/src/server/server.c:177:8: [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(URL_BASE_API_1_1_SENSORS)) data/psensor-1.1.5/src/server/server.c:178:14: [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). && nurl[strlen(URL_BASE_API_1_1_SENSORS)] == '/') { data/psensor-1.1.5/src/server/server.c:180: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). const char *sid = nurl + strlen(URL_BASE_API_1_1_SENSORS) + 1; data/psensor-1.1.5/src/server/server.c:196:42: [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). resp = MHD_create_response_from_buffer(strlen(page), data/psensor-1.1.5/src/server/server.c:254:39: [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 (!strncmp(nurl, URL_BASE_API_1_1, strlen(URL_BASE_API_1_1))) { data/psensor-1.1.5/src/server/server.c:261:8: [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). n = strlen(server_data.www_dir); data/psensor-1.1.5/src/server/server.c:279: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 MHD_create_response_from_buffer(strlen(page), data/psensor-1.1.5/src/ui_appindicator.c:190: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). tmp = malloc(strlen(label) data/psensor-1.1.5/src/ui_appindicator.c:192: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). + strlen(str) data/psensor-1.1.5/src/ui_appindicator.c:210: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). tmp = malloc(strlen(guide) data/psensor-1.1.5/src/ui_appindicator.c:212: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). + strlen(str) data/psensor-1.1.5/src/ui_notify.c:72:17: [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). body = malloc(strlen(sensor->name) + 3 + strlen(svalue) + 1); data/psensor-1.1.5/src/ui_notify.c:72:44: [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). body = malloc(strlen(sensor->name) + 3 + strlen(svalue) + 1); ANALYSIS SUMMARY: Hits = 121 Lines analyzed = 11135 in approximately 0.28 seconds (39798 lines/second) Physical Source Lines of Code (SLOC) = 7203 Hits@level = [0] 38 [1] 64 [2] 27 [3] 7 [4] 23 [5] 0 Hits@level+ = [0+] 159 [1+] 121 [2+] 57 [3+] 30 [4+] 23 [5+] 0 Hits/KSLOC@level+ = [0+] 22.0741 [1+] 16.7986 [2+] 7.91337 [3+] 4.16493 [4+] 3.19311 [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.