summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debsrcrecords.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb/debsrcrecords.cc')
-rw-r--r--apt-pkg/deb/debsrcrecords.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 5454d79c3..d296161d6 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -73,9 +73,12 @@ const char **debSrcRecordParser::Binaries()
char* bin = Buffer;
do {
char* binStartNext = strchrnul(bin, ',');
- char* binEnd = binStartNext - 1;
- for (; isspace_ascii(*binEnd) != 0; --binEnd)
- binEnd = 0;
+ // Found a comma, clean up any space before it
+ if (binStartNext > Buffer) {
+ char* binEnd = binStartNext - 1;
+ for (; binEnd > Buffer && isspace_ascii(*binEnd) != 0; --binEnd)
+ *binEnd = 0;
+ }
StaticBinList.push_back(bin);
if (*binStartNext != ',')
break;