diff --git a/lib_protocol/src/http/http_hdr_req.c b/lib_protocol/src/http/http_hdr_req.c index 6a196dd9b3873a7971c37d9957a747c2d5fe0d6e..e2e1cb9508e94df95cdc3e50ea7641adaa684fda 100644 --- a/lib_protocol/src/http/http_hdr_req.c +++ b/lib_protocol/src/http/http_hdr_req.c @@ -617,9 +617,16 @@ static void __strip_url_path(ACL_VSTRING *buf, const char *url) { ACL_ARGV *argv; const char *ptr; - const char last_ch = *(url + strlen(url) - 1); + char last_ch; ACL_ITER iter; + if (url == NULL || *url == 0) { + ACL_VSTRING_RESET(buf); + ACL_VSTRING_TERMINATE(buf); + return; + } + + last_ch = url[strlen(url) - 1]; argv = acl_argv_split(url, "/"); /* xxx: 必须将下面两行的初始化放在 acl_argv_split 的后面,因为 url