diff options
Diffstat (limited to 'src/menus.c')
-rw-r--r-- | src/menus.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/menus.c b/src/menus.c index d91dd24..eaf9cf9 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1983,8 +1983,8 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, break; case F_CUT: - strcpy(tmp, action); - strcat(tmp, "\n"); + strlcpy(tmp, action, sizeof(tmp)); + strlcat(tmp, "\n", sizeof(tmp)); XStoreBytes(dpy, tmp, strlen(tmp)); break; @@ -2358,7 +2358,11 @@ Execute(char *s) oldDisplay[0] = '\0'; doisplay=getenv("DISPLAY"); if (doisplay) - strcpy (oldDisplay, doisplay); + if (strlcpy (oldDisplay, doisplay, sizeof(oldDisplay)) >= + sizeof(oldDisplay)) { + /* some error report? */ + return; + } /* * Build a display string using the current screen number, so that @@ -2368,8 +2372,8 @@ Execute(char *s) */ colon = strrchr (ds, ':'); if (colon) { /* if host[:]:dpy */ - strcpy (buf, "DISPLAY="); - strcat (buf, ds); + strlcpy (buf, "DISPLAY=", sizeof(buf)); + strlcat (buf, ds, sizeof(buf)); colon = buf + 8 + (colon - ds); /* use version in buf */ dot1 = strchr (colon, '.'); /* first period after colon */ if (!dot1) dot1 = colon + strlen (colon); /* if not there, append */ @@ -2381,7 +2385,7 @@ Execute(char *s) (void) system (s); if (restorevar) { /* why bother? */ - (void) sprintf (buf, "DISPLAY=%s", oldDisplay); + (void) snprintf (buf, sizeof(buf), "DISPLAY=%s", oldDisplay); putenv (buf); } } |