From fe3dc1796894d22ad60da24d2bfc25fbf612861c Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Tue, 18 Dec 2018 00:06:20 -0500 Subject: [PATCH] [mod_fastcgi] fix NULL ptr deref from bugfix #2922 (fixes #2923) (thx rgenoud) x-ref: "SIGSEGV on file upload" https://redmine.lighttpd.net/issues/2923 --- src/mod_fastcgi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index 48af2550..901b0b2c 100644 --- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -187,7 +187,7 @@ static handler_t fcgi_stdin_append(server *srv, handler_ctx *hctx) { } fcgi_header(&(header), FCGI_STDIN, request_id, weWant, 0); - hctx->wb->first->type == MEM_CHUNK /* else FILE_CHUNK for temp file */ + (chunkqueue_is_empty(hctx->wb) || hctx->wb->first->type == MEM_CHUNK) /* else FILE_CHUNK for temp file */ ? chunkqueue_append_mem(hctx->wb, (const char *)&header, sizeof(header)) : chunkqueue_append_mem_min(hctx->wb, (const char *)&header, sizeof(header)); chunkqueue_steal(hctx->wb, req_cq, weWant);