From bc50d106ac8ffc1b3694c303b7a6916696661606 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 3 Dec 2018 09:29:23 +0100 Subject: [PATCH] aix: get rid of strcat() calls Insecure and unnecessary. Replace them with a call to snprintf(). PR-URL: https://github.com/libuv/libuv/pull/2065 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau --- src/unix/aix.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/unix/aix.c b/src/unix/aix.c index 29660e75777..fbe4450e916 100644 --- a/src/unix/aix.c +++ b/src/unix/aix.c @@ -365,12 +365,7 @@ static char *uv__rawname(char *cp) { if (dp == 0) return 0; - *dp = 0; - /* TODO(bnoordhuis) Check uv__strscpy() return value. */ - uv__strscpy(rawbuf, cp, sizeof(rawbuf)); - *dp = '/'; - strcat(rawbuf, "/r"); - strcat(rawbuf, dp+1); + snprintf(rawbuf, sizeof(rawbuf), "%.*s/r/%s", (int) (cp - dp), cp, dp + 1); return rawbuf; }