diff options
Diffstat (limited to 'main/fastcgi.c')
-rw-r--r-- | main/fastcgi.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/main/fastcgi.c b/main/fastcgi.c index 39bfd34531..cca4342f2a 100644 --- a/main/fastcgi.c +++ b/main/fastcgi.c @@ -739,7 +739,7 @@ int fcgi_listen(const char *path, int backlog) #else int path_len = strlen(path); - if (path_len >= sizeof(sa.sa_unix.sun_path)) { + if (path_len >= (int)sizeof(sa.sa_unix.sun_path)) { fcgi_log(FCGI_ERROR, "Listening socket's path name is too long.\n"); return -1; } @@ -1086,11 +1086,14 @@ static int fcgi_read_request(fcgi_request *req) req->id = (hdr.requestIdB1 << 8) + hdr.requestIdB0; if (hdr.type == FCGI_BEGIN_REQUEST && len == sizeof(fcgi_begin_request)) { + fcgi_begin_request *b; + if (safe_read(req, buf, len+padding) != len+padding) { return 0; } - req->keep = (((fcgi_begin_request*)buf)->flags & FCGI_KEEP_CONN); + b = (fcgi_begin_request*)buf; + req->keep = (b->flags & FCGI_KEEP_CONN); #ifdef TCP_NODELAY if (req->keep && req->tcp && !req->nodelay) { # ifdef _WIN32 @@ -1103,7 +1106,7 @@ static int fcgi_read_request(fcgi_request *req) req->nodelay = 1; } #endif - switch ((((fcgi_begin_request*)buf)->roleB1 << 8) + ((fcgi_begin_request*)buf)->roleB0) { + switch ((b->roleB1 << 8) + b->roleB0) { case FCGI_RESPONDER: fcgi_hash_set(&req->env, FCGI_HASH_FUNC("FCGI_ROLE", sizeof("FCGI_ROLE")-1), "FCGI_ROLE", sizeof("FCGI_ROLE")-1, "RESPONDER", sizeof("RESPONDER")-1); break; @@ -1589,7 +1592,7 @@ int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int l } memcpy(req->out_pos, str, len); req->out_pos += len; - } else if (len - limit < sizeof(req->out_buf) - sizeof(fcgi_header)) { + } else if (len - limit < (int)(sizeof(req->out_buf) - sizeof(fcgi_header))) { if (!req->out_hdr) { open_packet(req, type); } |