From 65fe4ef6f5674b0b52e797924990b090dbbd52af Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 1 Oct 2018 20:48:21 -0700 Subject: 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 --- mkfontscale.c | 5 +++-- 1 file 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; -- cgit v1.2.3