summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-01-21 17:59:44 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2019-01-21 18:05:10 -0500
commitb31e7840d5403bc640579135b7004793b9ccd6c0 (patch)
tree6b1fd50b6a13d20a088ae744fb07ad62214b5f16
parenta929de7ae500f5e66a157a7b2e6b439617b001c2 (diff)
downloadlighttpd1.4-b31e7840d5403bc640579135b7004793b9ccd6c0.tar.gz
lighttpd1.4-b31e7840d5403bc640579135b7004793b9ccd6c0.zip
[multiple] quiet clang --analyze where trivial
quiet clang --analyze warnings where trivial to do so
-rw-r--r--src/buffer.c2
-rw-r--r--src/http-header-glue.c4
-rw-r--r--src/mod_extforward.c2
-rw-r--r--src/mod_rewrite.c5
-rw-r--r--src/mod_ssi.c2
5 files changed, 10 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c
index f958e17f..261adf55 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -612,7 +612,6 @@ void buffer_append_string_encoded(buffer *b, const char *s, size_t s_len, buffer
d = (unsigned char*) buffer_string_prepare_append(b, d_len);
buffer_commit(b, d_len); /* fill below */
- force_assert('\0' == *d);
for (ds = (unsigned char *)s, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) {
if (map[*ds]) {
@@ -669,7 +668,6 @@ void buffer_append_string_c_escaped(buffer *b, const char *s, size_t s_len) {
d = (unsigned char*) buffer_string_prepare_append(b, d_len);
buffer_commit(b, d_len); /* fill below */
- force_assert('\0' == *d);
for (ds = (unsigned char *)s, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) {
if ((*ds < 0x20) /* control character */
diff --git a/src/http-header-glue.c b/src/http-header-glue.c
index 8c80d680..e8f6a743 100644
--- a/src/http-header-glue.c
+++ b/src/http-header-glue.c
@@ -31,6 +31,7 @@ int http_response_buffer_append_authority(server *srv, connection *con, buffer *
sock_addr our_addr;
socklen_t our_addr_len;
+ our_addr.plain.sa_family = 0;
our_addr_len = sizeof(our_addr);
if (-1 == getsockname(con->fd, (struct sockaddr *)&our_addr, &our_addr_len)
@@ -245,7 +246,8 @@ static int http_response_parse_range(server *srv, connection *con, buffer *path,
for (s = range, error = 0;
!error && *s && NULL != (minus = strchr(s, '-')); ) {
char *err;
- off_t la, le;
+ off_t la = 0, le;
+ *((const char **)&err) = s; /*(quiet clang --analyze)*/
if (s != minus) {
la = strtoll(s, &err, 10);
diff --git a/src/mod_extforward.c b/src/mod_extforward.c
index 1493e16b..15235314 100644
--- a/src/mod_extforward.c
+++ b/src/mod_extforward.c
@@ -730,7 +730,7 @@ static handler_t mod_extforward_Forwarded (server *srv, connection *con, plugin_
used = j+1;
offsets[used] = -1; /* mark end of last set of params */
- while (j > 0) { /*(param=value pairs, so j > 0, not j >= 0)*/
+ while (j >= 4) { /*(param=value pairs)*/
if (-1 == offsets[j]) { --j; continue; }
do {
j -= 3; /*(k, klen, v, vlen come in sets of 4)*/
diff --git a/src/mod_rewrite.c b/src/mod_rewrite.c
index a582b8ad..1280d978 100644
--- a/src/mod_rewrite.c
+++ b/src/mod_rewrite.c
@@ -240,6 +240,11 @@ static handler_t process_rewrite_rules(server *srv, connection *con, plugin_data
if (hctx->loops++ > 100) {
data_config *dc = p->conf.context;
+ if (NULL == dc) {
+ log_error_write(srv, __FILE__, __LINE__, "s",
+ "ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request");
+ return HANDLER_ERROR;
+ }
log_error_write(srv, __FILE__, __LINE__, "SbbSBS",
"ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request, perhaps you want to use url.rewrite-once instead of url.rewrite-repeat ($", dc->comp_key, dc->op, "\"", dc->string, "\")");
diff --git a/src/mod_ssi.c b/src/mod_ssi.c
index 20984aa7..f05f8a6e 100644
--- a/src/mod_ssi.c
+++ b/src/mod_ssi.c
@@ -1210,7 +1210,7 @@ static int mod_ssi_handle_request(server *srv, connection *con, handler_ctx *p)
/* Reset the modified time of included files */
include_file_last_mtime = 0;
- mod_ssi_process_file(srv, con, p, &st);
+ if (mod_ssi_process_file(srv, con, p, &st)) return -1;
con->file_started = 1;
con->file_finished = 1;