From 9a8f5f58ed654c7328792e0f0ea6f6eb381c6777 Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 05:24:23 +0000 Subject: [PATCH] fix(OSQUERY-010): 2 review findings in apt_sources.cpp --- osquery/tables/system/linux/apt_sources.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osquery/tables/system/linux/apt_sources.cpp b/osquery/tables/system/linux/apt_sources.cpp index 1485d881358..04dcfad3512 100644 --- a/osquery/tables/system/linux/apt_sources.cpp +++ b/osquery/tables/system/linux/apt_sources.cpp @@ -84,7 +84,7 @@ Status parseAptSourceLine(const std::string& input_line, apt_source.base_uri = tokens[offset]; // Cannot have trailing slashes - while (apt_source.base_uri.back() == '/') { + while (!apt_source.base_uri.empty() && apt_source.base_uri.back() == '/') { apt_source.base_uri.pop_back(); } @@ -264,7 +264,7 @@ Status parseDeb822Block(const std::string& input_block, continue; } // Cannot have trailing slashes - while (uri.back() == '/') { + while (!uri.empty() && uri.back() == '/') { uri.pop_back(); } uris.push_back(uri); @@ -400,3 +400,4 @@ QueryData genAptSrcs(QueryContext& context) { } } // namespace tables } // namespace osquery +