mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtwm/PopUpMenu: Coverity (memory corruption, moderate)
This commit is contained in:
parent
611dda1831
commit
f05c124807
1 changed files with 5 additions and 4 deletions
|
@ -220,18 +220,19 @@ AddWorkspaceCB (Widget w,
|
|||
|
||||
|
||||
{
|
||||
SwitchData * switch_data;
|
||||
SwitchData * switch_data = NULL;
|
||||
char * switch_name;
|
||||
char * temp_name;
|
||||
|
||||
int append;
|
||||
int i;
|
||||
|
||||
int slen;
|
||||
|
||||
/* Get the beginning part of the new name */
|
||||
|
||||
temp_name = FPGETMESSAGE (82, 35, "New");
|
||||
switch_name = XtMalloc (strlen (temp_name) + 5);
|
||||
slen = strlen (temp_name) + 5 + 1;
|
||||
switch_name = XtCalloc(1, slen);
|
||||
strcpy (switch_name, temp_name);
|
||||
|
||||
|
||||
|
@ -265,7 +266,7 @@ AddWorkspaceCB (Widget w,
|
|||
if (strcmp (switch_name, switch_data->switch_names[i]) == 0)
|
||||
{
|
||||
good_name = False;
|
||||
sprintf (switch_name, "%s_%d", temp_name, append);
|
||||
snprintf (switch_name, slen - 1, "%s_%d", temp_name, append);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue