[ros-dev] [ros-diffs] 01/01: [WINLOGON] Clean up part 2 - Replace the UNICODE_STRING usMessage by a PWSTR pszMessage. - Use the "%02d:%02d:%02d" time format and get rid of the safe string printf because the string will NEVER be longer than 8 characters. - Rename the timer id constant because it is NOT a resource id. - Rename variables according to the coding style.
Thomas Faber
thomas.faber at reactos.org
Mon Apr 2 12:12:44 UTC 2018
Hey Eric,
On 2018-04-02 12:58, Eric Kohl wrote:
> - RtlStringCbPrintfW(strbuf, sizeof(strbuf), L"%d:%d:%d", hours, minutes, seconds);
> + swprintf(szBuffer, L"%02d:%02d:%02d", iHours, iMinutes, iSeconds);
Unfortunately I must disagree with this change.
Buffer overflows are a big enough threat that code review and
static analysis are not generally considered sufficient to protect
against them.
So it's best practice for new code to always verify sizes at run-time,
and never to use s(w)print.
Best regards,
Thomas
PS: from what I see, iHours can be as large as 1193046, which won't
fit in 2 digits
More information about the Ros-dev
mailing list