Skip to content

Commit 7139696

Browse files
committed
RDKEMW-6891: coverity fix xdial
1 parent 87c3803 commit 7139696

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/plat/gdial-plat-util.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void gdial_plat_util_log(gdial_plat_util_LogLevel level,
110110
const char *levelMap[] = {"FATAL", "ERROR", "WARN", "INFO", "VERBOSE", "TRACE"};
111111
const short kFormatMessageSize = 4096;
112112
char formatted[kFormatMessageSize];
113+
char file_str[1024];
113114

114115
if (((FATAL_LEVEL != level)&&(ERROR_LEVEL != level))&&
115116
(gDefaultLogLevel < level)){
@@ -120,10 +121,13 @@ void gdial_plat_util_log(gdial_plat_util_LogLevel level,
120121
va_start(argptr, format);
121122
vsnprintf(formatted, kFormatMessageSize, format, argptr);
122123
va_end(argptr);
124+
/*Fix coverity error RW.EXPR_NOT_STRUCT_OR_UNION */
125+
strncpy(file_str, file, sizeof(file_str));
126+
file_str[sizeof(file_str) - 1] = '\0';
123127
fprintf(stderr, "[GDIAL][%d] %s [%s:%d] %s: %s \n",
124128
(int)syscall(SYS_gettid),
125129
levelMap[level],
126-
basename(file).c_str(),
130+
basename(file_str),
127131
line,
128132
func,
129133
formatted);

0 commit comments

Comments
 (0)