The following issues were found
libnetdata/threads/threads.h
1 issues
Line: 37
Column: 43
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
#define NETDATA_THREAD_NAME_MAX 15
extern void uv_thread_set_name_np(uv_thread_t ut, const char* name);
extern void os_thread_get_current_name_np(char threadname[NETDATA_THREAD_NAME_MAX + 1]);
#define netdata_thread_self pthread_self
#define netdata_thread_testcancel pthread_testcancel
#endif //NETDATA_THREADS_H
Reported by FlawFinder.
collectors/perf.plugin/perf_plugin.c
1 issues
Line: 403
Column: 33
CWE codes:
120
20
for(cpu = 0; cpu < number_of_cpus; cpu++) {
ssize_t read_size = read(current_event->fd[cpu], &read_result, sizeof(read_result));
if(likely(read_size == sizeof(read_result))) {
if (likely(read_result.time_running
&& read_result.time_running != *(current_event->prev_time_running + cpu)
&& (read_result.time_enabled / read_result.time_running < RUNNING_THRESHOLD))) {
Reported by FlawFinder.
collectors/proc.plugin/sys_kernel_mm_ksm.c
1 issues
Line: 8
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
#define PLUGIN_PROC_MODULE_KSM_NAME "/sys/kernel/mm/ksm"
typedef struct ksm_name_value {
char filename[FILENAME_MAX + 1];
unsigned long long value;
} KSM_NAME_VALUE;
#define PAGES_SHARED 0
#define PAGES_SHARING 1
Reported by FlawFinder.
daemon/global_statistics.c
1 issues
Line: 166
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#else
global_statistics_lock();
memcpy(gs, (const void *)&global_statistics, sizeof(struct global_statistics));
if (options & GLOBAL_STATS_RESET_WEB_USEC_MAX)
global_statistics.web_usec_max = 0;
global_statistics_unlock();
Reported by FlawFinder.
registry/registry.c
1 issues
Line: 26
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
// COOKIES
static void registry_set_cookie(struct web_client *w, const char *guid) {
char edate[100], domain[512];
time_t et = now_realtime_sec() + registry.persons_expiration;
struct tm etmbuf, *etm = gmtime_r(&et, &etmbuf);
strftime(edate, sizeof(edate), "%a, %d %b %Y %H:%M:%S %Z", etm);
snprintfz(w->cookie1, NETDATA_WEB_REQUEST_COOKIE_SIZE, NETDATA_REGISTRY_COOKIE_NAME "=%s; Expires=%s", guid, edate);
Reported by FlawFinder.
collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/__init__.py
1 issues
Line: 1
Column: 1
# SPDX-License-Identifier: MIT
import sys
try:
# Our match_hostname function is the same as 3.5's, so we only want to
# import the match_hostname function if it's at least that good.
if sys.version_info < (3, 5):
raise ImportError("Fallback to vendored code")
Reported by Pylint.
registry/registry_init.c
1 issues
Line: 7
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
#include "registry_internals.h"
int registry_init(void) {
char filename[FILENAME_MAX + 1];
// registry enabled?
if(web_server_mode != WEB_SERVER_MODE_NONE) {
registry.enabled = config_get_boolean(CONFIG_SECTION_REGISTRY, "enabled", 0);
}
Reported by FlawFinder.
daemon/buildinfo.c
1 issues
Line: 341
Column: 9
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
#ifndef ACLK_LEGACY_DISABLED
#if defined(ENABLE_ACLK) && defined(ACLK_LEGACY)
{
char buf[20];
snprintfz(buf, 19, "|LWS v%d.%d.%d", LWS_LIBRARY_VERSION_MAJOR, LWS_LIBRARY_VERSION_MINOR, LWS_LIBRARY_VERSION_PATCH);
if(FEAT_LWS) buffer_strcat(b, buf);
}
#else
if(FEAT_LWS) buffer_strcat(b, "|LWS");
Reported by FlawFinder.
collectors/proc.plugin/plugin_proc.c
1 issues
Line: 248
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
numa_node_count = 0;
char name[FILENAME_MAX + 1];
snprintfz(name, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/devices/system/node");
char *dirname = config_get("plugin:proc:/sys/devices/system/node", "directory to monitor", name);
DIR *dir = opendir(dirname);
if (dir) {
Reported by FlawFinder.
registry/registry_machine.c
1 issues
Line: 63
Column: 9
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
if(likely(machine_guid && *machine_guid)) {
// validate it is a GUID
char buf[GUID_LEN + 1];
if(unlikely(regenerate_guid(machine_guid, buf) == -1))
info("Registry: machine guid '%s' is not a valid guid. Ignoring it.", machine_guid);
else {
machine_guid = buf;
m = registry_machine_find(machine_guid);
Reported by FlawFinder.