Browse Source

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
pull/1373/head
Richard Fuchs 4 years ago
parent
commit
d61b6ef81f
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      recording-daemon/packet.c

+ 3
- 1
recording-daemon/packet.c View File

@ -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;


Loading…
Cancel
Save