Patch: Subtle defects in FormatMessageWrapper
From: Dmitry <wipedout_at_yandex.ru>
Date: Mon, 01 Feb 2010 17:16:03 +0300
Hey.
There're several issues with using FormatMessage() wrapper.
First of all, the wrapper is only suitable for one-time use. If CFormatMessageWrapper::release() is called from the second call to ObtainMessage() on an already initialized wrapper variable it will call LocalFree() which can alter global "last error", so the next message retrieval result will be plain wrong.
Also there're couple of sites where FormatMessage() is used without a wrapper, LPVOID is not initialized prior to FormatMessage() call and the return value of the latter is not checked either. So if FormatMessage() fails the LPVOID will be likely left uninitialized and program will run into undefined behaviour.
Patch addressing these issues follows.
Best wishes.
------------------------------------------------------
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
|
This is an archived mail posted to the TortoiseSVN Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.