summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-10-05 18:14:38 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-10-05 18:14:38 +0200
commit7be8c02360bdb9bd7f59b087da874f88af2a7206 (patch)
treec74317519bd5f9b73316c418f8356faf24a50441 /ftparchive
parent16f46f38c081fb942acc6051a707020495812a9a (diff)
parenta865ed25fa54514224cf4d6f83dd9cf48b7ed02b (diff)
* apt-pkg/contrib/configuration.cc:
- fix double delete (LP: #848907) - ignore only the invalid regexp instead of all options * apt-pkg/acquire-item.h, apt-pkg/deb/debmetaindex.cc: - fix fetching language information by adding OptionalSubIndexTarget * methods/https.cc: - cleanup broken downloads properly * ftparchive/cachedb.cc: - fix buffersize in bytes2hex * apt-pkg/deb/deblistparser.cc: - fix crash when the dynamic mmap needs to be grown in LoadReleaseInfo (LP: #854090)
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/cachedb.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc
index a1d70f912..6eccb8d4a 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -299,11 +299,15 @@ bool CacheDB::LoadContents(bool const &GenOnly)
/*}}}*/
static string bytes2hex(uint8_t *bytes, size_t length) {
- char space[65];
- if (length * 2 > sizeof(space) - 1) length = (sizeof(space) - 1) / 2;
- for (size_t i = 0; i < length; i++)
- snprintf(&space[i*2], 3, "%02x", bytes[i]);
- return string(space);
+ char buf[3];
+ string space;
+
+ space.reserve(length*2 + 1);
+ for (size_t i = 0; i < length; i++) {
+ snprintf(buf, sizeof(buf), "%02x", bytes[i]);
+ space.append(buf);
+ }
+ return space;
}
static inline unsigned char xdig2num(char const &dig) {