From f102ef64da6432cb58fee968f62abff3c1eb9948 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 3 Mar 2013 19:37:49 +0100 Subject: [PATCH 1/4] core/static: Add missing break in switch Reported by Coverity as CID #970990. --- core/static.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/static.c b/core/static.c index 5d318061..e263f220 100644 --- a/core/static.c +++ b/core/static.c @@ -148,6 +148,7 @@ static time_t parse_http_date(char *date, uint16_t len) { case 'N': hdtm.tm_mon = 10; + break; case 'D': hdtm.tm_mon = 11; From e4e346772a15e08ba4452484c62636c230cbefae Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 3 Mar 2013 19:44:30 +0100 Subject: [PATCH 2/4] core/ini: change ini_get_line size type The only user of ini_get_line uses a size_t as size. Since off_t and size_t have different storage size just switch ini_get_line to size_t. Reported by Coverity as CID #970984. --- core/ini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ini.c b/core/ini.c index 5fc9fcd0..faed46ca 100644 --- a/core/ini.c +++ b/core/ini.c @@ -54,7 +54,7 @@ char *ini_get_key(char *key) { return ptr; } -char *ini_get_line(char *ini, off_t size) { +char *ini_get_line(char *ini, size_t size) { off_t i; char *ptr = ini; From 0b0a0ccce111192adfbb6141f7ecd50adda8e804 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 3 Mar 2013 19:47:45 +0100 Subject: [PATCH 3/4] core/yaml: use size_t for buffer lenght in yaml_get_line As the only user pass a size_t value and they have different storage size. Reported by Coverity as CID #970987. --- core/yaml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/yaml.c b/core/yaml.c index 14179256..c69c49c4 100644 --- a/core/yaml.c +++ b/core/yaml.c @@ -61,7 +61,7 @@ int yaml_get_depth(char *line) { return depth; } -char *yaml_get_line(char *yaml, off_t size) { +char *yaml_get_line(char *yaml, size_t size) { off_t i; char *ptr = yaml; From 511a0aca0be1ad93167c49b1b77f23b86681289c Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 3 Mar 2013 19:51:40 +0100 Subject: [PATCH 4/4] plugins/http: remove self assignment Also while at it cleanup the handling of the if branch around the ifdefery. Reported by Coverity as CID #970999. --- plugins/http/keepalive.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/http/keepalive.c b/plugins/http/keepalive.c index 1396521a..48164463 100644 --- a/plugins/http/keepalive.c +++ b/plugins/http/keepalive.c @@ -152,12 +152,9 @@ int http_response_parse(struct http_session *hr, struct uwsgi_buffer *ub, size_t } } - hr->session.can_keepalive = hr->session.can_keepalive; - } - else if (hr->session.can_keepalive) { -#else - if (hr->session.can_keepalive) { + } else #endif + if (hr->session.can_keepalive) { if (uhttp.auto_chunked) { char cr = buf[len-2]; char nl = buf[len-1];