From 16845d8c922184edd1a08638401ac2e3ed15e0ec Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 13 Jul 2017 08:51:30 +0200 Subject: [PATCH] pcap-log: fix path construct check --- src/log-pcap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/log-pcap.c b/src/log-pcap.c index 758e1e6950..cd8acc164b 100644 --- a/src/log-pcap.c +++ b/src/log-pcap.c @@ -1254,7 +1254,7 @@ static int PcapLogOpenFileCtx(PcapLogData *pl) ret = snprintf(filename, PATH_MAX, "%s/%s.%" PRIu32 ".%" PRIu32, pl->dir, pl->prefix, (uint32_t)ts.tv_sec, (uint32_t)ts.tv_usec); } - if (ret < 0 || (size_t)ret >= sizeof(filename)) { + if (ret < 0 || (size_t)ret >= PATH_MAX) { SCLogError(SC_ERR_SPRINTF,"failed to construct path"); goto error; } @@ -1312,7 +1312,7 @@ static int PcapLogOpenFileCtx(PcapLogData *pl) ret = snprintf(filename, PATH_MAX, "%s/%s.%u.%" PRIu32 ".%" PRIu32, pl->dir, pl->prefix, pl->thread_number, (uint32_t)ts.tv_sec, (uint32_t)ts.tv_usec); } - if (ret < 0 || (size_t)ret >= sizeof(filename)) { + if (ret < 0 || (size_t)ret >= PATH_MAX) { SCLogError(SC_ERR_SPRINTF,"failed to construct path"); goto error; }