summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-20 14:46:09 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-20 14:46:09 -0700
commit0a94633e3d805ca477fba6b7acb673d055a3f43d (patch)
treef5dc7724938672b4a4d5c91502ee833fddce4f7d
parent0d276835222eeb57de56f56cd9e12611b1d30466 (diff)
Convert strcpy/strcat pairs to snprintf calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/authutil.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/authutil.c b/src/authutil.c
index dbd8b92..05d23a1 100644
--- a/src/authutil.c
+++ b/src/authutil.c
@@ -119,8 +119,8 @@ IceAuthFileName (void)
bsize = size;
}
- strcpy (buf, name);
- strcat (buf, slashDotICEauthority + (name[1] == '\0' ? 1 : 0));
+ snprintf (buf, bsize, "%s%s", name,
+ slashDotICEauthority + (name[1] == '\0' ? 1 : 0));
return (buf);
}
@@ -143,10 +143,8 @@ IceLockAuthFile (
if ((int) strlen (file_name) > 1022)
return (IceAuthLockError);
- strcpy (creat_name, file_name);
- strcat (creat_name, "-c");
- strcpy (link_name, file_name);
- strcat (link_name, "-l");
+ snprintf (creat_name, sizeof(creat_name), "%s-c", file_name);
+ snprintf (link_name, sizeof(link_name), "%s-l", file_name);
if (stat (creat_name, &statb) != -1)
{
@@ -217,15 +215,10 @@ IceUnlockAuthFile (
return;
#ifndef WIN32
- strcpy (creat_name, file_name);
- strcat (creat_name, "-c");
-#endif
- strcpy (link_name, file_name);
- strcat (link_name, "-l");
-
-#ifndef WIN32
+ snprintf (creat_name, sizeof(creat_name), "%s-c", file_name);
unlink (creat_name);
#endif
+ snprintf (link_name, sizeof(link_name), "%s-l", file_name);
unlink (link_name);
}