diff --git a/jcl/source/vcl/JclGraphUtils.pas b/jcl/source/vcl/JclGraphUtils.pas index d4aff254bd..9b617bda86 100644 --- a/jcl/source/vcl/JclGraphUtils.pas +++ b/jcl/source/vcl/JclGraphUtils.pas @@ -380,7 +380,7 @@ procedure GDIError; begin ErrorCode := GetLastError; if (ErrorCode <> 0) and (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nil, - ErrorCode, LOCALE_USER_DEFAULT, Buf, SizeOf(Buf), nil) <> 0) then + ErrorCode, LOCALE_USER_DEFAULT, Buf, Length(Buf), nil) <> 0) then raise EOutOfResources.Create(Buf) else OutOfResources;