From be5f46f92d57fa3be8effc33ed50a4a36cf982c8 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Thu, 4 Jun 2020 09:14:24 +0800 Subject: [PATCH] cleanup --- src/misc/misc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/misc/misc.c b/src/misc/misc.c index afa15fc6..e3d25824 100644 --- a/src/misc/misc.c +++ b/src/misc/misc.c @@ -1470,11 +1470,18 @@ int __mg_path_joint (char* dst, int dst_size, if (__mg_is_abs_path(abs_path) && (!__mg_is_abs_path(sub_path))) { if (dst_size >= strlen(abs_path) + strlen(sub_path) + 2/* size of split '/' and terminator '\0' */) { - sprintf(dst, "%s/%s", abs_path, sub_path); + strcpy (dst, abs_path); + strcat (dst, "/"); + strcat (dst, sub_path); + //sprintf(dst, "%s/%s", abs_path, sub_path); return 0; } + else { + _WRN_PRINTF ("The buffer space for the full path is too short: %d\n", dst_size); + } } } + return -1; }