mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
Fix a buffer overflow in ConvertULargeInteger
svn path=/trunk/; revision=42623
This commit is contained in:
parent
555a242381
commit
d05d3811ed
1 changed files with 4 additions and 4 deletions
|
@ -182,7 +182,7 @@ WORD wDefColor; /* default color */
|
|||
INT
|
||||
ConvertULargeInteger(ULONGLONG num, LPTSTR des, INT len, BOOL bPutSeperator)
|
||||
{
|
||||
TCHAR temp[32];
|
||||
TCHAR temp[39]; /* maximum length with nNumberGroups == 1 */
|
||||
UINT n, iTarget;
|
||||
|
||||
if (len <= 1)
|
||||
|
@ -198,15 +198,15 @@ ConvertULargeInteger(ULONGLONG num, LPTSTR des, INT len, BOOL bPutSeperator)
|
|||
if (iTarget == n && bPutSeperator)
|
||||
{
|
||||
iTarget += nNumberGroups + 1;
|
||||
temp[31 - n++] = cThousandSeparator;
|
||||
temp[38 - n++] = cThousandSeparator;
|
||||
}
|
||||
temp[31 - n++] = (TCHAR)(num % 10) + _T('0');
|
||||
temp[38 - n++] = (TCHAR)(num % 10) + _T('0');
|
||||
num /= 10;
|
||||
} while (num > 0);
|
||||
if (n > len-1)
|
||||
n = len-1;
|
||||
|
||||
memcpy(des, temp + 32 - n, n * sizeof(TCHAR));
|
||||
memcpy(des, temp + 39 - n, n * sizeof(TCHAR));
|
||||
des[n] = _T('\0');
|
||||
|
||||
return n;
|
||||
|
|
Loading…
Reference in a new issue