Home Dashboard Directory Help
Search

CHttpFile::QueryInfo() returns "corrupted" CStrings with invalid lengths. by ijprest


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 773448
Opened: 12/4/2012 12:15:00 PM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

The implementation of the CString form of CHttpFile::QueryInfo() calls HttpQueryInfo to determine how big a buffer to allocate, which is always reported in bytes.

Since CHttpFile::QueryInfo() neglects to divide by sizeof(TCHAR), it ends up allocating a buffer twice as big as necessary in UNICODE builds.

When CHttpFile::QueryInfo() subsequently calls ReleaseBuffer() on the CString, it again specifies the incorrect size. As a result, the CString thinks it's bigger than it actually is, and cannot be used normally (e.g., in CString contenation scenarios).
Details
Sign in to post a comment.
Posted by Microsoft on 12/7/2012 at 12:54 AM
Hi ijprest, thanks for your response, we have received your demo project.
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by ijprest on 12/5/2012 at 9:22 AM
I have attached a demo project (I think).
Posted by Microsoft on 12/4/2012 at 11:02 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. In order to efficiently investigate and reproduce this issue, we are requesting a demo project. Please submit this information to us within 3 business days. We look forward to hearing from you with this information.
Posted by Microsoft on 12/4/2012 at 12:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
httpfiletest.zip 12/5/2012 16 KB