summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iconmgr.c4
-rw-r--r--src/menus.c25
-rw-r--r--src/parse.c4
-rw-r--r--src/resize.c2
-rw-r--r--src/session.c8
5 files changed, 23 insertions, 20 deletions
diff --git a/src/iconmgr.c b/src/iconmgr.c
index d2d611e..e0fea0a 100644
--- a/src/iconmgr.c
+++ b/src/iconmgr.c
@@ -93,8 +93,8 @@ void CreateIconManagers()
JunkX, JunkY, p->width, p->height, 1,
Scr->Black, background);
- sprintf(str, "%s Icon Manager", p->name);
- sprintf(str1, "%s Icons", p->name);
+ snprintf(str, sizeof(str), "%s Icon Manager", p->name);
+ snprintf(str1, sizeof(str1), "%s Icons", p->name);
if (p->icon_name)
icon_name = p->icon_name;
else
diff --git a/src/menus.c b/src/menus.c
index 1bf32bf..4dd4da9 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -2387,7 +2387,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);
}
}
@@ -2592,7 +2592,7 @@ Identify (TwmWindow *t)
unsigned udummy;
n = 0;
- (void) sprintf(Info[n++], "Twm version: %s", Version);
+ snprintf(Info[n++], INFO_SIZE, "Twm version: %s", Version);
Info[n++][0] = '\0';
if (t) {
@@ -2600,24 +2600,27 @@ Identify (TwmWindow *t)
&wwidth, &wheight, &bw, &depth);
(void) XTranslateCoordinates (dpy, t->w, Scr->Root, 0, 0,
&x, &y, &junk);
- (void) sprintf(Info[n++], "Name = \"%s\"", t->full_name);
- (void) sprintf(Info[n++], "Class.res_name = \"%s\"", t->class.res_name);
- (void) sprintf(Info[n++], "Class.res_class = \"%s\"", t->class.res_class);
+ snprintf(Info[n++], INFO_SIZE,
+ "Name = \"%s\"", t->full_name);
+ snprintf(Info[n++], INFO_SIZE,
+ "Class.res_name = \"%s\"", t->class.res_name);
+ snprintf(Info[n++], INFO_SIZE,
+ "Class.res_class = \"%s\"", t->class.res_class);
Info[n++][0] = '\0';
- (void) sprintf(Info[n++], "Geometry/root = %dx%d+%d+%d", wwidth, wheight,
- x, y);
- (void) sprintf(Info[n++], "Border width = %d", bw);
- (void) sprintf(Info[n++], "Depth = %d", depth);
+ snprintf(Info[n++], INFO_SIZE,
+ "Geometry/root = %dx%d+%d+%d", wwidth, wheight, x, y);
+ snprintf(Info[n++], INFO_SIZE, "Border width = %d", bw);
+ snprintf(Info[n++], INFO_SIZE, "Depth = %d", depth);
if (HasSync)
{
int priority;
(void)XSyncGetPriority(dpy, t->w, &priority);
- (void) sprintf(Info[n++], "Priority = %d", priority);
+ snprintf(Info[n++], INFO_SIZE, "Priority = %d", priority);
}
}
Info[n++][0] = '\0';
- (void) sprintf(Info[n++], "Click to dismiss....");
+ snprintf(Info[n++], INFO_SIZE, "Click to dismiss....");
/* figure out the width and height of the info window */
height = n * (Scr->DefaultFont.height+2);
diff --git a/src/parse.c b/src/parse.c
index 1831d39..dd79092 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -179,8 +179,8 @@ int ParseTwmrc (char *filename)
if (home) {
homelen = strlen (home);
cp = tmpfilename;
- (void) sprintf (tmpfilename, "%s/.twmrc.%d",
- home, Scr->screen);
+ (void) snprintf (tmpfilename, sizeof(tmpfilename),
+ "%s/.twmrc.%d", home, Scr->screen);
break;
}
}
diff --git a/src/resize.c b/src/resize.c
index 9a8717f..cd7550f 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -510,7 +510,7 @@ DisplaySize(TwmWindow *tmp_win, int width, int height)
dheight /= tmp_win->hints.height_inc;
}
- (void) sprintf (str, " %4d x %-4d ", dwidth, dheight);
+ (void) snprintf (str, sizeof(str), " %4d x %-4d ", dwidth, dheight);
XRaiseWindow(dpy, Scr->SizeWindow);
MyFont_ChangeGC(Scr->DefaultC.fore, Scr->DefaultC.back, &Scr->SizeFont);
MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont,
diff --git a/src/session.c b/src/session.c
index 297f207..485eaf3 100644
--- a/src/session.c
+++ b/src/session.c
@@ -738,7 +738,7 @@ int *pFd;
char tempFile[PATH_MAX];
char *tmp;
- sprintf (tempFile, "%s/%sXXXXXX", path, prefix);
+ snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix);
tmp = (char *) mktemp (tempFile);
if (tmp)
{
@@ -753,7 +753,7 @@ int *pFd;
char tempFile[PATH_MAX];
char *ptr;
- sprintf (tempFile, "%s/%sXXXXXX", path, prefix);
+ snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix);
ptr = (char *)malloc(strlen(tempFile) + 1);
if (ptr != NULL)
{
@@ -802,7 +802,7 @@ SmPointer clientData;
prop1val.value = Argv[0];
prop1val.length = strlen (Argv[0]);
- sprintf (userId, "%ld", (long)getuid());
+ snprintf (userId, sizeof(userId), "%ld", (long)getuid());
prop2.name = SmUserID;
prop2.type = SmARRAY8;
prop2.num_vals = 1;
@@ -921,7 +921,7 @@ SmPointer clientData;
prop1.num_vals = numVals;
- sprintf (discardCommand, "rm %s", filename);
+ snprintf (discardCommand, sizeof(discardCommand), "rm %s", filename);
prop2.name = SmDiscardCommand;
prop2.type = SmARRAY8;
prop2.num_vals = 1;