From f298e6ce6e8d61d333a8c3970834bcffccdb9825 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Tue, 20 Oct 2009 12:57:44 +0000 Subject: fix crash on empty doc_root --- sapi/cgi/cgi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sapi/cgi') diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index f78cc484aa..449e0cf172 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -828,7 +828,7 @@ static int sapi_cgi_activate(TSRMLS_D) /* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */ if (doc_root) { doc_root_len = strlen(doc_root); - if (IS_SLASH(doc_root[doc_root_len - 1])) { + if (doc_root_len > 0 && IS_SLASH(doc_root[doc_root_len - 1])) { --doc_root_len; } #ifdef PHP_WIN32 -- cgit v1.2.1