Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for fixing #291 #292

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Samples/Win7Samples/dataaccess/oledb/rowsetviewer/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,8 @@ HRESULT SafeArrayToString(SAFEARRAY* pSafeArray, DBTYPE wType, WCHAR* pwszBuffer

CVariant cVariant;
WCHAR* pwsz = pwszBuffer;
WCHAR* pwszEnd = pwsz + ulMaxSize;
WCHAR* pwszEnd2 = pwsz + ulMaxSize;
WCHAR* pwszEnd = pwszEnd2 - 1; //We will reserve a last symbol for wEOL

ULONG i,iDim, ulInnerElements = 0;
ULONG cDimensions = SafeArrayGetDim(pSafeArray);
Expand Down Expand Up @@ -1257,6 +1258,11 @@ HRESULT SafeArrayToString(SAFEARRAY* pSafeArray, DBTYPE wType, WCHAR* pwszBuffer
pwsz++;
}

ASSERT(pwsz <= pwszEnd);
ASSERT(pwsz < pwszEnd2);

(*pwsz) = wEOL;

CLEANUP:
SAFE_FREE(rgIndices);
return hr;
Expand Down