Browse Source

[multiple] quiet some clang-analyzer warnings

master
Glenn Strauss 3 months ago
parent
commit
5ccebbf04e
  1. 2
      src/h2.c
  2. 2
      src/mod_cgi.c
  3. 2
      src/mod_fastcgi.c
  4. 1
      src/t/test_request.c

2
src/h2.c

@ -1479,7 +1479,7 @@ h2_parse_frames (connection * const con)
*/
if (cqlen < 9+flen) return 1; /* incomplete frame; go on */
if (clen < 9+flen) {
clen = h2_frame_cq_compact(cq, 9+flen);
clen = h2_frame_cq_compact(cq, 9+flen); UNUSED(clen);
c = cq->first; /*(reload after h2_frame_cq_compact())*/
s = (uint8_t *)(c->mem->ptr + c->offset);
}

2
src/mod_cgi.c

@ -513,7 +513,7 @@ static int cgi_env_add(void *venv, const char *key, size_t key_len, const char *
dst = env->ptr + env->used;
memcpy(dst, key, key_len);
dst[key_len] = '=';
memcpy(dst + key_len + 1, val, val_len);
if (val_len) memcpy(dst + key_len + 1, val, val_len);
dst[key_len + 1 + val_len] = '\0';
if (env->osize == env->oused) {

2
src/mod_fastcgi.c

@ -190,7 +190,7 @@ static int fcgi_env_add(void *venv, const char *key, size_t key_len, const char
dst = buffer_string_prepare_append(env, len);
memcpy(dst, len_enc, len_enc_len);
memcpy(dst + len_enc_len, key, key_len);
memcpy(dst + len_enc_len + key_len, val, val_len);
if (val_len) memcpy(dst + len_enc_len + key_len, val, val_len);
buffer_commit(env, len);
return 0;

1
src/t/test_request.c

@ -29,6 +29,7 @@ static void run_http_request_parse(request_st * const r, int line, int status, c
memcpy(hdrs, req, reqlen);
hloffsets[0] = 1;
hloffsets[1] = 0;
hloffsets[2] = 0;
for (const char *n=req, *end=req+reqlen; (n=memchr(n,'\n',end-n)); ++n) {
if (++hloffsets[0] >= sizeof(hloffsets)/sizeof(*hloffsets)) break;
hloffsets[hloffsets[0]] = n - req + 1;

Loading…
Cancel
Save