Skip to content

Commit ee11125

Browse files
committed
Merge pull request #6 from gwroblew/remotes/trunk
Minor changes to IIS module.
2 parents ce3cf00 + 2336cf9 commit ee11125

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

iis/mymodule.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* ModSecurity for Apache 2.x, http://www.modsecurity.org/
33
* Copyright (c) 2004-2011 Trustwave Holdings, Inc. (http://www.trustwave.com/)
44
*
@@ -796,8 +796,8 @@ CMyHttpModule::OnBeginRequest(
796796

797797
HTTP_REQUEST *req = pRequest->GetRawHttpRequest();
798798

799-
r->hostname = ConvertUTF16ToUTF8(req->CookedUrl.pHost, req->CookedUrl.HostLength, r->pool);
800-
r->path_info = ConvertUTF16ToUTF8(req->CookedUrl.pAbsPath, req->CookedUrl.AbsPathLength, r->pool);
799+
r->hostname = ConvertUTF16ToUTF8(req->CookedUrl.pHost, req->CookedUrl.HostLength / sizeof(WCHAR), r->pool);
800+
r->path_info = ConvertUTF16ToUTF8(req->CookedUrl.pAbsPath, req->CookedUrl.AbsPathLength / sizeof(WCHAR), r->pool);
801801

802802
if(r->hostname == NULL)
803803
{
@@ -825,8 +825,8 @@ CMyHttpModule::OnBeginRequest(
825825
}
826826
}
827827

828-
if(req->CookedUrl.pQueryString != NULL)
829-
r->args = ConvertUTF16ToUTF8(req->CookedUrl.pQueryString + 1, req->CookedUrl.QueryStringLength - 1, r->pool);
828+
if(req->CookedUrl.pQueryString != NULL && req->CookedUrl.QueryStringLength > 0)
829+
r->args = ConvertUTF16ToUTF8(req->CookedUrl.pQueryString + 1, (req->CookedUrl.QueryStringLength / sizeof(WCHAR)) - 1, r->pool);
830830

831831
#define _TRANSHEADER(id,str) if(req->Headers.KnownHeaders[id].pRawValue != NULL) \
832832
{\

0 commit comments

Comments
 (0)