From: Christophe CURIS <christophe.cu...@free.fr>

Coverity warned because the 2 strcpy may overflow the target buffer (the
code relies on a constant for the max allowed workspace name length).

As in both cases the temporary copy is not useful because the temp copy
will be strdup'd just after, this patch removes the temporary buffer and
uses directly the string.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 src/dock.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/dock.c b/src/dock.c
index 2b8925b..8b13568 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -948,7 +948,6 @@ static void launchDockedApplication(WAppIcon *btn, Bool 
withSelection)
 static void updateWorkspaceMenu(WMenu *menu, WAppIcon *icon)
 {
        WScreen *scr = menu->frame->screen_ptr;
-       char title[MAX_WORKSPACENAME_WIDTH + 1];
        int i;
 
        if (!menu || !icon)
@@ -958,15 +957,12 @@ static void updateWorkspaceMenu(WMenu *menu, WAppIcon 
*icon)
                if (i < menu->entry_no) {
                        if (strcmp(menu->entries[i]->text, 
scr->workspaces[i]->name) != 0) {
                                wfree(menu->entries[i]->text);
-                               strcpy(title, scr->workspaces[i]->name);
-                               menu->entries[i]->text = wstrdup(title);
+                               menu->entries[i]->text = 
wstrdup(scr->workspaces[i]->name);
                                menu->flags.realized = 0;
                        }
                        menu->entries[i]->clientdata = (void *)icon;
                } else {
-                       strcpy(title, scr->workspaces[i]->name);
-
-                       wMenuAddCallback(menu, title, switchWSCommand, (void 
*)icon);
+                       wMenuAddCallback(menu, scr->workspaces[i]->name, 
switchWSCommand, (void *)icon);
 
                        menu->flags.realized = 0;
                }
-- 
2.1.1


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to