summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2016-09-04 10:13:23 +0100
committerMatthieu Herrb <matthieu@herrb.eu>2016-09-04 10:13:23 +0100
commit3141f3015a2ef7b3274bf4d01107dc68990d4583 (patch)
tree1455540dac2e852077075e6c32a91972514f1779
parentafdd997d2210ff6a5781f579b92d5e9eff93093c (diff)
replace strcpy() with snprintf()
-rw-r--r--xdm/auth.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/xdm/auth.c b/xdm/auth.c
index c6bd091..7c9697c 100644
--- a/xdm/auth.c
+++ b/xdm/auth.c
@@ -460,13 +460,12 @@ SetAuthorization (struct display *d)
}
static int
-openFiles (char *name, char *new_name, FILE **oldp, FILE **newp)
+openFiles (char *name, char *new_name, size_t len, FILE **oldp, FILE **newp)
{
mode_t mask;
int newfd;
- strcpy (new_name, name);
- strcat (new_name, "-n");
+ snprintf(new_name, len, "%s-n", name);
/*
* Set safe umask for file creation operations.
*/
@@ -802,7 +801,7 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
lockStatus = XauLockAuth (home_name, 1, 2, 10);
Debug ("Lock is %d\n", lockStatus);
if (lockStatus == LOCK_SUCCESS) {
- if (openFiles (home_name, new_name, &old, &new)
+ if (openFiles (home_name, new_name, sizeof(new_name), &old, &new)
&& (old != NULL) && (new != NULL)) {
name = home_name;
setenv = 0;
@@ -834,7 +833,8 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
lockStatus = XauLockAuth (backup_name, 1, 2, 10);
Debug ("backup lock is %d\n", lockStatus);
if (lockStatus == LOCK_SUCCESS) {
- if (openFiles (backup_name, new_name, &old, &new)
+ if (openFiles (backup_name, new_name, sizeof(new_name),
+ &old, &new)
&& (old != NULL) && (new != NULL)) {
name = backup_name;
setenv = 1;
@@ -969,7 +969,7 @@ RemoveUserAuthorization (struct display *d, struct verify_info *verify)
if (lockStatus != LOCK_SUCCESS)
return;
old = NULL;
- if (openFiles (name, new_name, &old, &new))
+ if (openFiles (name, new_name, sizeof(new_name), &old, &new))
{
initAddrs ();
doWrite = 0;