diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-03-30 11:18:44 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-03-30 11:18:44 -0700 |
commit | 704beb71768cdaa2448da6edfa219b4a7bf862f1 (patch) | |
tree | 31646078d37ccee89d9bb89019ae3cad7e58559f /AuFileName.c | |
parent | 3038a87edce31ad2895431f7cfdc96a33fc70e02 (diff) |
Replace strcpy+strcat pairs with snprintf calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'AuFileName.c')
-rw-r--r-- | AuFileName.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/AuFileName.c b/AuFileName.c index 473fad1..0904273 100644 --- a/AuFileName.c +++ b/AuFileName.c @@ -57,9 +57,8 @@ XauFileName (void) name = getenv ("HOME"); if (!name) { #ifdef WIN32 - (void) strcpy (dir, "/users/"); if ((name = getenv("USERNAME"))) { - (void) strcat (dir, name); + snprintf(dir, sizeof(dir), "/users/%s", name); name = dir; } if (!name) @@ -81,7 +80,7 @@ XauFileName (void) bsize = size; } - strcpy (buf, name); - strcat (buf, slashDotXauthority + (name[1] == '\0' ? 1 : 0)); + snprintf (buf, bsize, "%s%s", name, + slashDotXauthority + (name[1] == '\0' ? 1 : 0)); return buf; } |