Always take a sizeof(WCHAR) into account when moving memory
This commit is contained in:
parent
297b201f33
commit
d8a260795e
@ -765,7 +765,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
|||||||
{
|
{
|
||||||
if(InputFieldLength > 0 && TextPosition < InputFieldLength)
|
if(InputFieldLength > 0 && TextPosition < InputFieldLength)
|
||||||
{
|
{
|
||||||
RtlMoveMemory(InputFieldBuffer + TextPosition, InputFieldBuffer + TextPosition + 1, InputFieldLength - TextPosition);
|
RtlMoveMemory(InputFieldBuffer + TextPosition, InputFieldBuffer + TextPosition + 1, (InputFieldLength - TextPosition) * sizeof(WCHAR));
|
||||||
InputFieldLength--;
|
InputFieldLength--;
|
||||||
InputFieldBuffer[InputFieldLength] = 0;
|
InputFieldBuffer[InputFieldLength] = 0;
|
||||||
}
|
}
|
||||||
@ -779,7 +779,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
|||||||
if(InputFieldLength > 0 && TextPosition > 0 && TextPosition <= InputFieldLength)
|
if(InputFieldLength > 0 && TextPosition > 0 && TextPosition <= InputFieldLength)
|
||||||
{
|
{
|
||||||
TextPosition--;
|
TextPosition--;
|
||||||
RtlMoveMemory(InputFieldBuffer + TextPosition, InputFieldBuffer + TextPosition + 1, InputFieldLength - TextPosition);
|
RtlMoveMemory(InputFieldBuffer + TextPosition, InputFieldBuffer + TextPosition + 1, (InputFieldLength - TextPosition) * sizeof(WCHAR));
|
||||||
InputFieldLength--;
|
InputFieldLength--;
|
||||||
InputFieldBuffer[InputFieldLength] = 0;
|
InputFieldBuffer[InputFieldLength] = 0;
|
||||||
}
|
}
|
||||||
@ -796,7 +796,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
|||||||
{
|
{
|
||||||
if(InputFieldLength < Handle.Width - 8 - 1 && TextPosition < Handle.Width - 8 - 1)
|
if(InputFieldLength < Handle.Width - 8 - 1 && TextPosition < Handle.Width - 8 - 1)
|
||||||
{
|
{
|
||||||
RtlMoveMemory(InputFieldBuffer + TextPosition + 1, InputFieldBuffer + TextPosition, InputFieldLength - TextPosition);
|
RtlMoveMemory(InputFieldBuffer + TextPosition + 1, InputFieldBuffer + TextPosition, (InputFieldLength - TextPosition) * sizeof(WCHAR));
|
||||||
InputFieldBuffer[TextPosition] = Key.UnicodeChar;
|
InputFieldBuffer[TextPosition] = Key.UnicodeChar;
|
||||||
TextPosition++;
|
TextPosition++;
|
||||||
InputFieldLength++;
|
InputFieldLength++;
|
||||||
|
Loading…
Reference in New Issue
Block a user