From d61b6ef81fbb827bf8b32229c085feee4edb92d4 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 8 Sep 2021 09:02:03 -0400 Subject: [PATCH] TT#14008 silence Coverity warning Add a check for the return value from g_strlcpy in case the path ever gets truncated. Change-Id: I33c146357711c4d0810c025a5fd08e91cb87c524 Warned-by: Coverity --- recording-daemon/packet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recording-daemon/packet.c b/recording-daemon/packet.c index aafe5b3af..07cff3c2c 100644 --- a/recording-daemon/packet.c +++ b/recording-daemon/packet.c @@ -180,7 +180,9 @@ out: dbg("Metadata %s, output destination %s", mf->metadata, mf->output_dest); if (mf->output_dest) { char path[PATH_MAX]; - g_strlcpy(path, mf->output_dest, sizeof(path)); + size_t copied = g_strlcpy(path, mf->output_dest, sizeof(path)); + if (G_UNLIKELY(copied >= sizeof(path))) + ilog(LOG_ERR, "Output file path truncated: %s", mf->output_dest); char *sep = strrchr(path, '/'); if (sep) { char *filename = sep + 1;