mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:33:16 +00:00
size the buffer dynamically to avoid potentially overflowing it
svn path=/trunk/; revision=23438
This commit is contained in:
parent
c6b0db6688
commit
728a261829
1 changed files with 18 additions and 7 deletions
|
@ -466,14 +466,25 @@ DisplayTCPIPProperties(HWND hParent, IP_ADAPTER_INFO *pInfo)
|
||||||
PROPSHEETHEADERW psh;
|
PROPSHEETHEADERW psh;
|
||||||
INITCOMMONCONTROLSEX cce;
|
INITCOMMONCONTROLSEX cce;
|
||||||
TCPIP_PROPERTIES_DATA DlgData;
|
TCPIP_PROPERTIES_DATA DlgData;
|
||||||
TCHAR tpszCaption[MAX_PATH];
|
LPTSTR tpszCaption = NULL;
|
||||||
HWND hListBox = GetDlgItem(hParent,IDC_COMPONENTSLIST);
|
INT StrLen;
|
||||||
int iListBoxIndex = (int) SendMessage(hListBox,LB_GETCURSEL,0,0);
|
|
||||||
|
HWND hListBox = GetDlgItem(hParent, IDC_COMPONENTSLIST);
|
||||||
|
int iListBoxIndex = (int) SendMessage(hListBox, LB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
if(iListBoxIndex != LB_ERR)
|
if(iListBoxIndex != LB_ERR)
|
||||||
SendMessage(hListBox,LB_GETTEXT,iListBoxIndex,(LPARAM)tpszCaption);
|
{
|
||||||
else
|
StrLen = SendMessage(hListBox, LB_GETTEXTLEN, iListBoxIndex, 0);
|
||||||
_stprintf(tpszCaption,_T("[ERROR]"));
|
|
||||||
_tcscat(tpszCaption,_T(" Properties"));
|
if (StrLen != LB_ERR)
|
||||||
|
{
|
||||||
|
TCHAR suffix[] = _T(" Properties");
|
||||||
|
INT HeapSize = ((StrLen + 1) + (_tcslen(suffix) + 1)) * sizeof(TCHAR);
|
||||||
|
tpszCaption = (LPTSTR)HeapAlloc(GetProcessHeap(), 0, HeapSize);
|
||||||
|
SendMessage(hListBox, LB_GETTEXT, iListBoxIndex, (LPARAM)tpszCaption);
|
||||||
|
_tcscat(tpszCaption, suffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! LoadDataFromInfo(&DlgData, pInfo))
|
if (! LoadDataFromInfo(&DlgData, pInfo))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue