The following issues were found

deps/hiredis/examples/example-ssl.c
2 issues
atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 20 Column: 16 CWE codes: 190
Suggestion: 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)

                      exit(1);
    }
    const char *hostname = (argc > 1) ? argv[1] : "127.0.0.1";
    int port = atoi(argv[2]);
    const char *cert = argv[3];
    const char *key = argv[4];
    const char *ca = argc > 4 ? argv[5] : NULL;

    redisInitOpenSSL();

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

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

                  reply = redisCommand(c,"DEL mylist");
    freeReplyObject(reply);
    for (j = 0; j < 10; j++) {
        char buf[64];

        snprintf(buf,64,"%u",j);
        reply = redisCommand(c,"LPUSH mylist element-%s", buf);
        freeReplyObject(reply);
    }

            

Reported by FlawFinder.

deps/hiredis/examples/example.c
2 issues
atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 21 Column: 29 CWE codes: 190
Suggestion: 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)

                      }
    }

    int port = (argc > 2) ? atoi(argv[2]) : 6379;

    struct timeval timeout = { 1, 500000 }; // 1.5 seconds
    if (isunix) {
        c = redisConnectUnixWithTimeout(hostname, timeout);
    } else {

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

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

                  reply = redisCommand(c,"DEL mylist");
    freeReplyObject(reply);
    for (j = 0; j < 10; j++) {
        char buf[64];

        snprintf(buf,64,"%u",j);
        reply = redisCommand(c,"LPUSH mylist element-%s", buf);
        freeReplyObject(reply);
    }

            

Reported by FlawFinder.

deps/hiredis/ssl.c
2 issues
InitializeCriticalSection - Exceptions can be thrown in low-memory situations
Security

Line: 101 Column: 5 CWE codes:
Suggestion: Use InitializeCriticalSectionAndSpinCount instead

              #ifdef _WIN32
typedef CRITICAL_SECTION sslLockType;
static void sslLockInit(sslLockType* l) {
    InitializeCriticalSection(l);
}
static void sslLockAcquire(sslLockType* l) {
    EnterCriticalSection(l);
}
static void sslLockRelease(sslLockType* l) {

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 303 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 (c->err == 0) {
        char err[512];
        if (rv == SSL_ERROR_SYSCALL)
            snprintf(err,sizeof(err)-1,"SSL_connect failed: %s",strerror(errno));
        else {
            unsigned long e = ERR_peek_last_error();
            snprintf(err,sizeof(err)-1,"SSL_connect failed: %s",

            

Reported by FlawFinder.

deps/hiredis/win32.h
2 issues
snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 23 Column: 9 CWE codes: 134
Suggestion: Use a constant for the format specification

              #define va_copy(d,s) ((d) = (s))
#endif

#ifndef snprintf
#define snprintf c99_snprintf

__inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
{
    int count = -1;

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 24 Column: 9 CWE codes: 134
Suggestion: Use a constant for the format specification

              #endif

#ifndef snprintf
#define snprintf c99_snprintf

__inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
{
    int count = -1;


            

Reported by FlawFinder.

deps/jemalloc/include/jemalloc/internal/emitter.h
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 155 Column: 2 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

              	 * quickly without having to think about the various snprintf edge
	 * cases.
	 */
	char fmt[FMT_SIZE];
	char buf[BUF_SIZE];

#define EMIT_SIMPLE(type, format)					\
	emitter_gen_fmt(fmt, FMT_SIZE, format, justify, width);		\
	emitter_printf(emitter, fmt, *(const type *)value);		\

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 156 Column: 2 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

              	 * cases.
	 */
	char fmt[FMT_SIZE];
	char buf[BUF_SIZE];

#define EMIT_SIMPLE(type, format)					\
	emitter_gen_fmt(fmt, FMT_SIZE, format, justify, width);		\
	emitter_printf(emitter, fmt, *(const type *)value);		\


            

Reported by FlawFinder.

deps/jemalloc/include/jemalloc/internal/hash.h
2 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 30 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	if (unlikely((uintptr_t)p & (sizeof(uint32_t)-1)) != 0) {
		uint32_t ret;

		memcpy(&ret, (uint8_t *)(p + i), sizeof(uint32_t));
		return ret;
	}

	return p[i];
}

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 43 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	if (unlikely((uintptr_t)p & (sizeof(uint64_t)-1)) != 0) {
		uint64_t ret;

		memcpy(&ret, (uint8_t *)(p + i), sizeof(uint64_t));
		return ret;
	}

	return p[i];
}

            

Reported by FlawFinder.

deps/jemalloc/include/jemalloc/internal/log.h
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

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

               * statements.
 */

extern char log_var_names[JEMALLOC_LOG_VAR_BUFSIZE];
extern atomic_b_t log_init_done;

typedef struct log_var_s log_var_t;
struct log_var_s {
	/*

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 90 Column: 2 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
log_impl_varargs(const char *name, ...) {
	char buf[JEMALLOC_LOG_BUFSIZE];
	va_list ap;

	va_start(ap, name);
	const char *format = va_arg(ap, const char *);
	size_t dst_offset = 0;

            

Reported by FlawFinder.

deps/jemalloc/msvc/test_threads/test_threads.cpp
2 issues
getchar - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 37 Column: 3 CWE codes: 120 20

                size_t sz1 = sizeof(allocated1);
  je_mallctl("stats.active", (void *)&allocated1, &sz1, NULL, 0);
  printf("\nPress Enter to start threads...\n");
  getchar();
  printf("Starting %d threads x %d x %d iterations...\n", numThreads, numIter1, numIter2);
  for (int i = 0; i < numThreads; i++) {
    workers.emplace_back([tid=i]() {
      uniform_int_distribution<int> sizeDist(0, numSizes - 1);
      minstd_rand rnd(tid * 17);

            

Reported by FlawFinder.

getchar - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 86 Column: 3 CWE codes: 120 20

                bool failed = leaked > 65536; // in case C++ runtime allocated something (e.g. iostream locale or facet)
  printf("\nTest %s!\n", (failed ? "FAILED" : "successful"));
  printf("\nPress Enter to continue...\n");
  getchar();
  return failed ? 1 : 0;
}

            

Reported by FlawFinder.

deps/jemalloc/src/arena.c
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 584 Column: 13 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

                  arena_stats_decay_t *stats) {
	if (config_debug) {
		for (size_t i = 0; i < sizeof(arena_decay_t); i++) {
			assert(((char *)decay)[i] == 0);
		}
		decay->ceil_npages = 0;
	}
	if (malloc_mutex_init(&decay->mtx, "decay", WITNESS_RANK_DECAY,
	    malloc_mutex_rank_exclusive)) {

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 1667 Column: 2 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	 */

	size_t copysize = (usize < oldsize) ? usize : oldsize;
	memcpy(ret, ptr, copysize);
	isdalloct(tsdn, ptr, oldsize, tcache, NULL, true);
	return ret;
}

dss_prec_t

            

Reported by FlawFinder.

deps/jemalloc/src/log.c
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 6 Column: 1 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 "jemalloc/internal/log.h"

char log_var_names[JEMALLOC_LOG_VAR_BUFSIZE];
atomic_b_t log_init_done = ATOMIC_INIT(false);

/*
 * Returns true if we were able to pick out a segment.  Fills in r_segment_end
 * with a pointer to the first character after the end of the string.

            

Reported by FlawFinder.

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)
Security

Line: 46 Column: 44 CWE codes: 126

              unsigned
log_var_update_state(log_var_t *log_var) {
	const char *log_var_begin = log_var->name;
	const char *log_var_end = log_var->name + strlen(log_var->name);

	/* Pointer to one before the beginning of the current segment. */
	const char *segment_begin = log_var_names;

	/*

            

Reported by FlawFinder.