From 965a99a781788aef187869ec17994a006344c3bf Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 23 May 2019 15:41:42 -0700 Subject: [PATCH] Fix potential null-dereference in current_time() --- src/util.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util.cc b/src/util.cc index 7a5eb41c5f..2a6a5c37c4 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1507,13 +1507,11 @@ double current_time(bool real) double t = double(tv.tv_sec) + double(tv.tv_usec) / 1e6; - const iosource::Manager::PktSrcList& pkt_srcs(iosource_mgr->GetPktSrcs()); - - if ( ! pseudo_realtime || real || pkt_srcs.empty() ) + if ( ! pseudo_realtime || real || ! iosource_mgr || iosource_mgr->GetPktSrcs().empty() ) return t; // This obviously only works for a single source ... - iosource::PktSrc* src = pkt_srcs.front(); + iosource::PktSrc* src = iosource_mgr->GetPktSrcs().front(); if ( net_is_processing_suspended() ) return src->CurrentPacketTimestamp();