summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2010-12-09 23:44:42 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2010-12-22 10:41:34 -0800
commit84f73c49db8071c06f27609ce7cc7a32a17351a9 (patch)
tree3eebab3519b8e2c8da21a69318118ac57e8c50f6
parent14145f3e87a039640cd8bdb2e2f4f30ca9b2a710 (diff)
Convert some sprintf calls to snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--src/Selection.c2
-rw-r--r--src/Shell.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/Selection.c b/src/Selection.c
index 1759c02..101ea6a 100644
--- a/src/Selection.c
+++ b/src/Selection.c
@@ -226,7 +226,7 @@ static Atom GetSelectionProperty(
propCount = sarray->propCount++;
sarray->list = (SelectionProp) XtRealloc((XtPointer)sarray->list,
(unsigned)(sarray->propCount*sizeof(SelectionPropRec)));
- (void) sprintf(propname, "%s%d", "_XT_SELECTION_", propCount);
+ (void) snprintf(propname, sizeof(propname), "_XT_SELECTION_%d", propCount);
sarray->list[propCount].prop = XInternAtom(dpy, propname, FALSE);
sarray->list[propCount].avail = FALSE;
return(sarray->list[propCount].prop);
diff --git a/src/Shell.c b/src/Shell.c
index 732e978..ef6dad2 100644
--- a/src/Shell.c
+++ b/src/Shell.c
@@ -1780,7 +1780,8 @@ static void GetGeometry(
}
else hints.flags = 0;
- sprintf( def_geom, "%dx%d+%d+%d", width, height, x, y );
+ snprintf( def_geom, sizeof(def_geom), "%dx%d+%d+%d",
+ width, height, x, y );
flag = XWMGeometry( XtDisplay(W),
XScreenNumberOfScreen(XtScreen(W)),
w->shell.geometry, def_geom,
@@ -3013,7 +3014,7 @@ static void SetSessionProperties(
user_name = _XtGetUserName(nam_buf, sizeof nam_buf);
if (user_name)
props[num_props++] = ArrayPack(SmUserID, &user_name);
- sprintf(pid, "%ld", (long)getpid());
+ snprintf(pid, sizeof(pid), "%ld", (long)getpid());
props[num_props++] = ArrayPack(SmProcessID, &pidp);
if (num_props) {