[sheepdog] [PATCH v2 2/3] http: fix a segfault if DOCUMENT_URI is NULL string

Liu Yuan namei.unix at gmail.com
Fri Nov 15 06:50:44 CET 2013


Current code will segfault if we don't specify DOCUMENT_URI in nginx conf file.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/http/http.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/sheep/http/http.c b/sheep/http/http.c
index aaaec18..fb7aac2 100644
--- a/sheep/http/http.c
+++ b/sheep/http/http.c
@@ -164,6 +164,9 @@ static int request_init_operation(struct http_request *req)
 		return BAD_REQUEST;
 	}
 	req->uri = FCGX_GetParam("DOCUMENT_URI", env);
+	if (!req->uri)
+		return BAD_REQUEST;
+
 	req->status = UNKNOWN;
 
 	return OK;
-- 
1.7.9.5




More information about the sheepdog mailing list