The following issues were found

collectors/proc.plugin/proc_uptime.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 10 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

              
    static char *uptime_filename = NULL;
    if(!uptime_filename) {
        char filename[FILENAME_MAX + 1];
        snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/uptime");

        uptime_filename = config_get("plugin:proc:/proc/uptime", "filename to monitor", filename);
    }


            

Reported by FlawFinder.

exporting/tests/exporting_fixtures.c
1 issues
strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 59 Column: 5 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

                  localhost->rrdset_root = calloc(1, sizeof(RRDSET));
    RRDSET *st = localhost->rrdset_root;
    st->rrdhost = localhost;
    strcpy(st->id, "chart_id");
    st->name = strdupz("chart_name");
    st->flags |= RRDSET_FLAG_ENABLED;
    st->rrd_memory_mode |= RRD_MEMORY_MODE_SAVE;
    st->update_every = 1;


            

Reported by FlawFinder.

health/health_json.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 172 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

              }

static inline void health_rrdcalc2json_nolock(RRDHOST *host, BUFFER *wb, RRDCALC *rc) {
    char value_string[100 + 1];
    format_value_and_unit(value_string, 100, rc->value, rc->units, -1);

    char *replaced_info = NULL;
    if (likely(rc->info)) {
        char *m;

            

Reported by FlawFinder.

collectors/ebpf.plugin/ebpf_mount.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 14 Column: 8 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

                                                        .map_fd = ND_EBPF_MAP_FD_NOT_INITIALIZED}};

static ebpf_data_t mount_data;
static char *mount_dimension_name[NETDATA_EBPF_MOUNT_SYSCALL] = { "mount", "umount" };
static netdata_syscall_stat_t mount_aggregated_data[NETDATA_EBPF_MOUNT_SYSCALL];
static netdata_publish_syscall_t mount_publish_aggregated[NETDATA_EBPF_MOUNT_SYSCALL];

struct config mount_config = { .first_section = NULL, .last_section = NULL, .mutex = NETDATA_MUTEX_INITIALIZER,
                               .index = {.avl_tree = { .root = NULL, .compar = appconfig_section_compare },

            

Reported by FlawFinder.

collectors/python.d.plugin/python_modules/pyyaml2/reader.py
1 issues
invalid syntax (<unknown>, line 159)
Error

Line: 159 Column: 43

                              try:
                    data, converted = self.raw_decode(self.raw_buffer,
                            'strict', self.eof)
                except UnicodeDecodeError, exc:
                    character = exc.object[exc.start]
                    if self.stream is not None:
                        position = self.stream_pointer-len(self.raw_buffer)+exc.start
                    else:
                        position = exc.start

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml2/constructor.py
1 issues
invalid syntax (<unknown>, line 131)
Error

Line: 131 Column: 30

                          key = self.construct_object(key_node, deep=deep)
            try:
                hash(key)
            except TypeError, exc:
                raise ConstructorError("while constructing a mapping", node.start_mark,
                        "found unacceptable key (%s)" % exc, key_node.start_mark)
            value = self.construct_object(value_node, deep=deep)
            mapping[key] = value
        return mapping

            

Reported by Pylint.

exporting/send_internal_metrics.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 61 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

                  // create charts for monitoring the exporting operations

    if (!stats->initialized) {
        char id[RRD_ID_LENGTH_MAX + 1];
        BUFFER *family = buffer_create(0);

        buffer_sprintf(family, "exporting_%s", instance->config.name);

        snprintf(id, RRD_ID_LENGTH_MAX, "exporting_%s_metrics", instance->config.name);

            

Reported by FlawFinder.

libnetdata/circular_buffer/circular_buffer.h
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 7 Column: 25 CWE codes: 120 20

              #include <string.h>

struct circular_buffer {
    size_t size, write, read, max_size;
    char *data;
};

extern struct circular_buffer *cbuffer_new(size_t initial, size_t max);
extern void cbuffer_free(struct circular_buffer *buf);

            

Reported by FlawFinder.

exporting/pubsub/pubsub_publish.cc
1 issues
strncpy - Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned]
Security

Line: 22 Column: 10 CWE codes: 120

              
static inline void copy_error_message(char *error_message_dst, const char *error_message_src)
{
    std::strncpy(error_message_dst, error_message_src, ERROR_LINE_MAX);
    error_message_dst[ERROR_LINE_MAX] = '\0';
}

/**
 * Initialize a Pub/Sub client and a data structure for responses.

            

Reported by FlawFinder.

collectors/ebpf.plugin/ebpf_disk.h
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 43 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

                  uint64_t end;   // end sector

    // Print information
    char family[NETDATA_DISK_NAME_LEN + 1];
    char *boot_chart;

    netdata_ebpf_histogram_t histogram;

    uint32_t flags;

            

Reported by FlawFinder.