From: Arran Cudbard-Bell Date: Sun, 11 Dec 2022 20:34:44 +0000 (-0600) Subject: Coverity fixes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f12ab33a1ffe3c586cf1c7cbdef8ba7ddaea453e;p=thirdparty%2Ffreeradius-server.git Coverity fixes --- diff --git a/scripts/build/log.c b/scripts/build/log.c index 5afafad3c5d..35a49ea8d7f 100644 --- a/scripts/build/log.c +++ b/scripts/build/log.c @@ -38,8 +38,7 @@ void _make_vlog(char const *log_keyword, char const *file, int line, char const char buffer[256]; char *p = buffer, *end = (p + (sizeof(buffer) - 1)); - /* coverity[fixed_size_dest] */ - strcpy(p, log_keyword); + strlcpy(p, log_keyword, (end - p) + 1); p += strlen(p); *p++ = ' '; diff --git a/scripts/jlibtool.c b/scripts/jlibtool.c index 0808592c9d1..862c26598d4 100644 --- a/scripts/jlibtool.c +++ b/scripts/jlibtool.c @@ -2709,7 +2709,8 @@ static int run_mode(command_t *cmd) break; case MODE_EXECUTE: { - char *l, libpath[PATH_MAX]; + char libpath[PATH_MAX]; + char *p = libpath, *end = p + (sizeof(libpath) - 1); if (!cmd->arglist->num) { ERROR("No command to execute.\n"); @@ -2721,15 +2722,18 @@ static int run_mode(command_t *cmd) /* * jlibtool is in $(BUILD_DIR)/make/jlibtool */ - /* coverity[fixed_size_dest] */ - strcpy(libpath, program); + strncpy(p, program, end - p); + *end = '\0'; /* * Libraries are relative to jlibtool, in * $(BUILD_DIR)/lib/local/.libs/ */ - l = strstr(libpath, "/make"); - if (l) strcpy(l, "/lib/local/.libs"); + p = strstr(libpath, "/make"); + if (p) { + strncpy(p, "/lib/local/.libs", end - p); + *end = '\0'; + } setenv(target->ld_library_path, libpath, 1); setenv(target->ld_library_path_local, libpath, 1);