[multiple] quiet coverity warnings
parent
f364c8ef36
commit
a3e9faa479
|
@ -93,6 +93,9 @@ static char* buffer_alloc_replace(buffer * const restrict b, const size_t size)
|
|||
|
||||
char* buffer_string_prepare_copy(buffer * const b, const size_t size) {
|
||||
b->used = 0;
|
||||
#ifdef __COVERITY__ /*(b->ptr is not NULL if b->size is not 0)*/
|
||||
force_assert(size >= b->size || b->ptr);
|
||||
#endif
|
||||
return (size < b->size)
|
||||
? b->ptr
|
||||
: buffer_alloc_replace(b, size);
|
||||
|
|
|
@ -373,7 +373,7 @@ static int chunkqueue_append_mem_extend_chunk(chunkqueue * const restrict cq, co
|
|||
|
||||
void chunkqueue_append_buffer(chunkqueue * const restrict cq, buffer * const restrict mem) {
|
||||
chunk *c;
|
||||
size_t len = mem ? buffer_clen(mem) : 0;
|
||||
const size_t len = buffer_clen(mem);
|
||||
if (len < 1024 && chunkqueue_append_mem_extend_chunk(cq, mem->ptr, len)) {
|
||||
buffer_clear(mem);
|
||||
return;
|
||||
|
|
|
@ -82,7 +82,11 @@ void chunkqueue_append_file(chunkqueue * restrict cq, const buffer * restrict fn
|
|||
void chunkqueue_append_file_fd(chunkqueue * restrict cq, const buffer * restrict fn, int fd, off_t offset, off_t len); /* copies "fn" */
|
||||
void chunkqueue_append_mem(chunkqueue * restrict cq, const char * restrict mem, size_t len); /* copies memory */
|
||||
void chunkqueue_append_mem_min(chunkqueue * restrict cq, const char * restrict mem, size_t len); /* copies memory */
|
||||
|
||||
__attribute_nonnull__
|
||||
void chunkqueue_append_buffer(chunkqueue * restrict cq, buffer * restrict mem); /* may reset "mem" */
|
||||
|
||||
__attribute_nonnull__
|
||||
void chunkqueue_append_chunkqueue(chunkqueue * restrict cq, chunkqueue * restrict src);
|
||||
|
||||
__attribute_returns_nonnull__
|
||||
|
|
|
@ -425,6 +425,9 @@ static int gw_proc_sockaddr_init(gw_host * const host, gw_proc * const proc, log
|
|||
BUF_PTR_LEN(proc->unixsocket));
|
||||
}
|
||||
else {
|
||||
#ifdef __COVERITY__
|
||||
force_assert(host->host); /*(not NULL if !host->unixsocket)*/
|
||||
#endif
|
||||
/*(note: name resolution here is *blocking* if IP string not supplied)*/
|
||||
if (1 != sock_addr_from_str_hints(&addr, &addrlen, host->host->ptr,
|
||||
0, proc->port, errh)) {
|
||||
|
|
|
@ -785,6 +785,9 @@ static int http_response_process_headers(request_st * const restrict r, http_res
|
|||
/* after the space should be a status code for us */
|
||||
int status = http_header_str_to_code(s+9);
|
||||
if (status >= 100 && status < 1000) {
|
||||
#ifdef __COVERITY__ /* Coverity false positive for tainted data */
|
||||
status = 200;/* http_header_str_to_code() validates, untaints */
|
||||
#endif
|
||||
r->http_status = status;
|
||||
opts->local_redir = 0; /*(disable; status was set)*/
|
||||
i = 2;
|
||||
|
|
|
@ -776,6 +776,9 @@ static int cgi_create_env(request_st * const r, plugin_data * const p, handler_c
|
|||
if (-1 == c->file.fd
|
||||
&& 0 != chunkqueue_open_file_chunk(cq, r->conf.errh))
|
||||
return -1;
|
||||
#ifdef __COVERITY__
|
||||
force_assert(-1 != c->file.fd);
|
||||
#endif
|
||||
if (-1 == lseek(c->file.fd, 0, SEEK_SET)) {
|
||||
log_perror(r->conf.errh, __FILE__, __LINE__,
|
||||
"lseek %s", c->mem->ptr);
|
||||
|
|
|
@ -74,6 +74,7 @@ static lua_State *script_cache_load_script(script * const sc, int etag_flags)
|
|||
} while (rd > 0 ? (off += rd) != sz : rd < 0 && errno == EINTR);
|
||||
if (off != sz) { /*(file truncated?)*/
|
||||
if (rd >= 0) errno = EIO;
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,10 @@ test_http_response_send_file (request_st * const r, time_t lmtime)
|
|||
"if-modified-since newer than st_mtime");
|
||||
test_mod_staticfile_reset(r);
|
||||
|
||||
#ifdef __COVERITY__ /* Coverity misses that this is set a few lines above */
|
||||
force_assert(http_header_request_get(r, HTTP_HEADER_IF_MODIFIED_SINCE,
|
||||
CONST_STR_LEN("If-Modified-Since")));
|
||||
#endif
|
||||
buffer_append_string_len(
|
||||
http_header_request_get(r, HTTP_HEADER_IF_MODIFIED_SINCE,
|
||||
CONST_STR_LEN("If-Modified-Since")),
|
||||
|
|
Loading…
Reference in New Issue