[USRMGR] Increase name sizes to 'UNLEN + 1'

This commit is contained in:
Serge Gautherie 2020-06-24 20:41:44 +02:00 committed by George Bișoc
parent 1cf1892b14
commit a120d67d0e
4 changed files with 28 additions and 28 deletions

View file

@ -155,7 +155,7 @@ AddSelectedUsersToGroup(HWND hwndDlg,
HWND hwndLV;
INT nSelectedItems;
INT nItem;
TCHAR szUserName[UNLEN];
TCHAR szUserName[UNLEN + 1];
BOOL bResult = FALSE;
LOCALGROUP_MEMBERS_INFO_3 memberInfo;
NET_API_STATUS status;
@ -172,7 +172,7 @@ AddSelectedUsersToGroup(HWND hwndDlg,
ListView_GetItemText(hwndLV,
nItem, 0,
szUserName,
UNLEN);
UNLEN + 1);
DebugPrintf(_TEXT("Selected user: %s"), szUserName);
@ -310,7 +310,7 @@ static VOID
RemoveUserFromGroup(HWND hwndDlg,
PGENERAL_GROUP_DATA pGroupData)
{
TCHAR szUserName[UNLEN];
TCHAR szUserName[UNLEN + 1];
TCHAR szText[256];
LOCALGROUP_MEMBERS_INFO_3 memberInfo;
HWND hwndLV;
@ -326,7 +326,7 @@ RemoveUserFromGroup(HWND hwndDlg,
ListView_GetItemText(hwndLV,
nItem, 0,
szUserName,
UNLEN);
UNLEN + 1);
/* Display a warning message because the remove operation cannot be reverted */
wsprintf(szText, TEXT("Do you really want to remove the user \"%s\" from the group \"%s\"?"),
@ -612,7 +612,7 @@ GroupProperties(HWND hwndDlg)
{
PROPSHEETPAGE psp[1];
PROPSHEETHEADER psh;
TCHAR szGroupName[UNLEN];
TCHAR szGroupName[UNLEN + 1];
INT nItem;
HWND hwndLV;
@ -625,7 +625,7 @@ GroupProperties(HWND hwndDlg)
ListView_GetItemText(hwndLV,
nItem, 0,
szGroupName,
UNLEN);
UNLEN + 1);
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);

View file

@ -90,7 +90,7 @@ UpdateGroupsList(HWND hwndListView)
static VOID
UpdateGroupProperties(HWND hwndDlg)
{
TCHAR szGroupName[UNLEN];
TCHAR szGroupName[UNLEN + 1];
INT iItem;
HWND hwndLV;
PLOCALGROUP_INFO_1 pGroupInfo = NULL;
@ -104,7 +104,7 @@ UpdateGroupProperties(HWND hwndDlg)
ListView_GetItemText(hwndLV,
iItem, 0,
szGroupName,
UNLEN);
UNLEN + 1);
NetLocalGroupGetInfo(NULL, szGroupName, 1, (LPBYTE*)&pGroupInfo);
@ -254,7 +254,7 @@ GroupRename(HWND hwndDlg)
static BOOL
GroupDelete(HWND hwndDlg)
{
TCHAR szGroupName[UNLEN];
TCHAR szGroupName[UNLEN + 1];
TCHAR szText[256];
INT nItem;
HWND hwndLV;
@ -269,7 +269,7 @@ GroupDelete(HWND hwndDlg)
ListView_GetItemText(hwndLV,
nItem, 0,
szGroupName,
UNLEN);
UNLEN + 1);
/* Display a warning message, because the delete operation cannot be reverted */
wsprintf(szText, TEXT("Dou you really want to delete the user group \"%s\"?"), szGroupName);
@ -336,8 +336,8 @@ OnGroupsPageBeginLabelEdit(LPNMLVDISPINFO pnmv)
static BOOL
OnGroupsPageEndLabelEdit(LPNMLVDISPINFO pnmv)
{
TCHAR szOldGroupName[UNLEN];
TCHAR szNewGroupName[UNLEN];
TCHAR szOldGroupName[UNLEN + 1];
TCHAR szNewGroupName[UNLEN + 1];
LOCALGROUP_INFO_0 lgrpi0;
NET_API_STATUS status;
@ -349,7 +349,7 @@ OnGroupsPageEndLabelEdit(LPNMLVDISPINFO pnmv)
ListView_GetItemText(pnmv->hdr.hwndFrom,
pnmv->item.iItem, 0,
szOldGroupName,
UNLEN);
UNLEN + 1);
/* Leave, if the user canceled the edit action */
if (pnmv->item.pszText == NULL)

View file

@ -316,7 +316,7 @@ static VOID
RemoveGroupFromUser(HWND hwndDlg,
PMEMBERSHIP_USER_DATA pUserData)
{
TCHAR szGroupName[UNLEN];
TCHAR szGroupName[UNLEN + 1];
TCHAR szText[256];
LOCALGROUP_MEMBERS_INFO_3 memberInfo;
HWND hwndLV;
@ -332,7 +332,7 @@ RemoveGroupFromUser(HWND hwndDlg,
ListView_GetItemText(hwndLV,
nItem, 0,
szGroupName,
UNLEN);
UNLEN + 1);
/* Display a warning message because the remove operation cannot be reverted */
wsprintf(szText, TEXT("Do you really want to remove the user \"%s\" from the group \"%s\"?"),
@ -441,7 +441,7 @@ AddSelectedGroupsToUser(HWND hwndDlg,
{
HWND hwndLV;
INT nItem;
TCHAR szGroupName[UNLEN];
TCHAR szGroupName[UNLEN + 1];
BOOL bResult = FALSE;
BOOL bFound;
DWORD i;
@ -459,7 +459,7 @@ AddSelectedGroupsToUser(HWND hwndDlg,
ListView_GetItemText(hwndLV,
nItem, 0,
szGroupName,
UNLEN);
UNLEN + 1);
bFound = FALSE;
for (i = 0; i < pUserData->dwGroupCount; i++)
@ -902,7 +902,7 @@ UserProperties(HWND hwndDlg)
{
PROPSHEETPAGE psp[3];
PROPSHEETHEADER psh;
TCHAR szUserName[UNLEN];
TCHAR szUserName[UNLEN + 1];
INT nItem;
HWND hwndLV;
@ -915,7 +915,7 @@ UserProperties(HWND hwndDlg)
ListView_GetItemText(hwndLV,
nItem, 0,
szUserName,
UNLEN);
UNLEN + 1);
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);

View file

@ -109,7 +109,7 @@ ChangePasswordDlgProc(HWND hwndDlg,
static VOID
UserChangePassword(HWND hwndDlg)
{
TCHAR szUserName[UNLEN];
TCHAR szUserName[UNLEN + 1];
USER_INFO_1003 user;
INT nItem;
HWND hwndLV;
@ -126,7 +126,7 @@ UserChangePassword(HWND hwndDlg)
ListView_GetItemText(hwndLV,
nItem, 0,
szUserName,
UNLEN);
UNLEN + 1);
if (DialogBoxParam(hApplet,
MAKEINTRESOURCE(IDD_CHANGE_PASSWORD),
@ -386,7 +386,7 @@ UserRename(HWND hwndDlg)
static BOOL
UserDelete(HWND hwndDlg)
{
TCHAR szUserName[UNLEN];
TCHAR szUserName[UNLEN + 1];
TCHAR szText[256];
INT nItem;
HWND hwndLV;
@ -401,7 +401,7 @@ UserDelete(HWND hwndDlg)
ListView_GetItemText(hwndLV,
nItem, 0,
szUserName,
UNLEN);
UNLEN + 1);
/* Display a warning message because the delete operation cannot be reverted */
wsprintf(szText, TEXT("Do you really want to delete the user \"%s\"?"), szUserName);
@ -550,8 +550,8 @@ OnBeginLabelEdit(LPNMLVDISPINFO pnmv)
static BOOL
OnEndLabelEdit(LPNMLVDISPINFO pnmv)
{
TCHAR szOldUserName[UNLEN];
TCHAR szNewUserName[UNLEN];
TCHAR szOldUserName[UNLEN + 1];
TCHAR szNewUserName[UNLEN + 1];
USER_INFO_0 useri0;
NET_API_STATUS status;
@ -563,7 +563,7 @@ OnEndLabelEdit(LPNMLVDISPINFO pnmv)
ListView_GetItemText(pnmv->hdr.hwndFrom,
pnmv->item.iItem, 0,
szOldUserName,
UNLEN);
UNLEN + 1);
/* Leave, if the user canceled the edit action */
if (pnmv->item.pszText == NULL)
@ -649,7 +649,7 @@ OnNotify(HWND hwndDlg, PUSER_DATA pUserData, NMHDR *phdr)
static VOID
UpdateUserProperties(HWND hwndDlg)
{
TCHAR szUserName[UNLEN];
TCHAR szUserName[UNLEN + 1];
INT iItem;
HWND hwndLV;
PUSER_INFO_2 pUserInfo = NULL;
@ -664,7 +664,7 @@ UpdateUserProperties(HWND hwndDlg)
ListView_GetItemText(hwndLV,
iItem, 0,
szUserName,
UNLEN);
UNLEN + 1);
NetUserGetInfo(NULL, szUserName, 2, (LPBYTE*)&pUserInfo);