summaryrefslogtreecommitdiff
path: root/mkfontscale.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2018-10-01 20:48:21 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2018-10-01 20:48:21 -0700
commit65fe4ef6f5674b0b52e797924990b090dbbd52af (patch)
tree1d3e2b664703ac43f9de4864f8dac2e52725ef3c /mkfontscale.c
parent7b4203577af4b835ef069e0cd2bd9510b599789c (diff)
Remove last use of strcat
If getcwd returned a string that exactly filled the prefix buffer, it could write the null terminator byte out of bounds. Instead, since the prefix is copied to a newly allocated string and never used again, just let the dsprintf() call take care of it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'mkfontscale.c')
-rw-r--r--mkfontscale.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mkfontscale.c b/mkfontscale.c
index eca8a1b..c2e1255 100644
--- a/mkfontscale.c
+++ b/mkfontscale.c
@@ -152,8 +152,9 @@ main(int argc, char **argv)
exit(1);
}
if(prefix[strlen(prefix) - 1] != '/')
- strcat(prefix, "/");
- encodingPrefix = dsprintf("%s", prefix);
+ encodingPrefix = dsprintf("%s/", prefix);
+ else
+ encodingPrefix = dsprintf("%s", prefix);
outfilename = NULL;