Applied patch [ 1405547 ] wxDbConnectInf + unicode = massive buffer overflows
Ove Kaaven git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -201,37 +201,37 @@ void wxDbConnectInf::FreeHenv()
|
|||||||
|
|
||||||
void wxDbConnectInf::SetDsn(const wxString &dsn)
|
void wxDbConnectInf::SetDsn(const wxString &dsn)
|
||||||
{
|
{
|
||||||
wxASSERT(dsn.Length() < sizeof(Dsn));
|
wxASSERT(dsn.Length() < WXSIZEOF(Dsn));
|
||||||
|
|
||||||
wxStrncpy(Dsn, dsn, sizeof(Dsn)-1);
|
wxStrncpy(Dsn, dsn, WXSIZEOF(Dsn)-1);
|
||||||
Dsn[sizeof(Dsn)-1] = 0; // Prevent buffer overrun
|
Dsn[WXSIZEOF(Dsn)-1] = 0; // Prevent buffer overrun
|
||||||
} // wxDbConnectInf::SetDsn()
|
} // wxDbConnectInf::SetDsn()
|
||||||
|
|
||||||
|
|
||||||
void wxDbConnectInf::SetUserID(const wxString &uid)
|
void wxDbConnectInf::SetUserID(const wxString &uid)
|
||||||
{
|
{
|
||||||
wxASSERT(uid.Length() < sizeof(Uid));
|
wxASSERT(uid.Length() < WXSIZEOF(Uid));
|
||||||
wxStrncpy(Uid, uid, sizeof(Uid)-1);
|
wxStrncpy(Uid, uid, WXSIZEOF(Uid)-1);
|
||||||
Uid[sizeof(Uid)-1] = 0; // Prevent buffer overrun
|
Uid[WXSIZEOF(Uid)-1] = 0; // Prevent buffer overrun
|
||||||
} // wxDbConnectInf::SetUserID()
|
} // wxDbConnectInf::SetUserID()
|
||||||
|
|
||||||
|
|
||||||
void wxDbConnectInf::SetPassword(const wxString &password)
|
void wxDbConnectInf::SetPassword(const wxString &password)
|
||||||
{
|
{
|
||||||
wxASSERT(password.Length() < sizeof(AuthStr));
|
wxASSERT(password.Length() < WXSIZEOF(AuthStr));
|
||||||
|
|
||||||
wxStrncpy(AuthStr, password, sizeof(AuthStr)-1);
|
wxStrncpy(AuthStr, password, WXSIZEOF(AuthStr)-1);
|
||||||
AuthStr[sizeof(AuthStr)-1] = 0; // Prevent buffer overrun
|
AuthStr[WXSIZEOF(AuthStr)-1] = 0; // Prevent buffer overrun
|
||||||
} // wxDbConnectInf::SetPassword()
|
} // wxDbConnectInf::SetPassword()
|
||||||
|
|
||||||
void wxDbConnectInf::SetConnectionStr(const wxString &connectStr)
|
void wxDbConnectInf::SetConnectionStr(const wxString &connectStr)
|
||||||
{
|
{
|
||||||
wxASSERT(connectStr.Length() < sizeof(ConnectionStr));
|
wxASSERT(connectStr.Length() < WXSIZEOF(ConnectionStr));
|
||||||
|
|
||||||
useConnectionStr = wxStrlen(connectStr) > 0;
|
useConnectionStr = wxStrlen(connectStr) > 0;
|
||||||
|
|
||||||
wxStrncpy(ConnectionStr, connectStr, sizeof(ConnectionStr)-1);
|
wxStrncpy(ConnectionStr, connectStr, WXSIZEOF(ConnectionStr)-1);
|
||||||
ConnectionStr[sizeof(ConnectionStr)-1] = 0; // Prevent buffer overrun
|
ConnectionStr[WXSIZEOF(ConnectionStr)-1] = 0; // Prevent buffer overrun
|
||||||
} // wxDbConnectInf::SetConnectionStr()
|
} // wxDbConnectInf::SetConnectionStr()
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user