Browse Source

[multiple] address coverity warnings

personal/stbuehler/ci-build
Glenn Strauss 1 year ago
parent
commit
3057b63ea2
  1. 2
      src/buffer.c
  2. 3
      src/gw_backend.c
  3. 5
      src/mod_openssl.c

2
src/buffer.c

@ -161,7 +161,7 @@ void buffer_copy_string(buffer * restrict b, const char * restrict s) {
}
void buffer_copy_string_len(buffer * const restrict b, const char * const restrict s, const size_t s_len) {
if (NULL == b || s_len >= b->size) buffer_alloc_replace(b, s_len);
if (NULL == b->ptr || s_len >= b->size) buffer_alloc_replace(b, s_len);
b->used = s_len + 1;
b->ptr[s_len] = '\0';

3
src/gw_backend.c

@ -439,6 +439,9 @@ static int env_add(char_array *env, const char *key, size_t key_len, const char
force_assert(env->ptr);
}
#ifdef __COVERITY__
force_assert(env->ptr); /*(non-NULL if env->used != 0; guaranteed above)*/
#endif
env->ptr[env->used++] = dst;
return 0;

5
src/mod_openssl.c

@ -461,10 +461,11 @@ mod_openssl_session_ticket_key_file (const char *fn)
if (rd == sizeof(buf) && buf[0] == 0) { /*(format version 0)*/
session_ticket_keys[3].active_ts = buf[1];
session_ticket_keys[3].expire_ts = buf[2];
#ifndef __COVERITY__ /* intentional; hide from Coverity Scan */
/* intentionally copy 80 bytes into consecutive arrays
* tick_key_name[], tick_hmac_key[], tick_aes_key[] */
void *x = (void *)&session_ticket_keys[3].tick_key_name;
memcpy(x, buf+3, 80);
memcpy(&session_ticket_keys[3].tick_key_name, buf+3, 80);
#endif
rc = 1;
}

Loading…
Cancel
Save