diff options
| author | Julian Andres Klode <jak@debian.org> | 2024-12-16 13:15:28 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2024-12-16 13:15:28 +0100 |
| commit | 19000fab15ab0b30c95a1bf6e034aa3c6bdc36cb (patch) | |
| tree | 5cbd401ba99532f1baf56daa06c4e8cc15d83c13 /apt-pkg | |
| parent | 93325e6c0eedfa16246f7ec0498ed6b3e4c6f553 (diff) | |
Fix out-of-bounds read in `apt show :`
We tried to access str.size() - 1 on a 0-sized string, which
does not work, and now that we build with assertions triggers
it.
Closes: #1090068
Diffstat (limited to 'apt-pkg')
| -rw-r--r-- | apt-pkg/cacheset.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index bfc85ef49..230e3d68f 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -60,6 +60,9 @@ bool CacheSetHelper::PackageFromTask(PackageContainerInterface * const pci, pkgC pattern.erase(archfound); } + if (pattern.empty()) + return false; + if (pattern[pattern.length() -1] != '^') return false; pattern.erase(pattern.length()-1); |
