summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-26 11:10:47 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-26 11:10:47 +0200
commitb9dc47069ab90a79ca3b9eae3cc85d38062d57ee (patch)
treee475dac924a3770c568e5a4149f4bc91c9275e47 /apt-pkg
parente0146bb1813743e9042c2aad4d1131ca382861c1 (diff)
add another escape test case, fixup octal one (its \0XX instead of \0XXX)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/strutl.cc9
-rw-r--r--apt-pkg/contrib/strutl.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index f9d8d7e90..e998d74dc 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1242,10 +1242,10 @@ bool CheckDomainList(const string &Host,const string &List)
/*}}}*/
// ProcessEscapeSequences /*{{{*/
// ---------------------------------------------------------------------
-/* */
+/* unescape (\0XX and \xXX) from a string */
string DeEscapeString(string &input)
{
- char tmp[5];
+ char tmp[3];
string::const_iterator it, escape_start;
string output, octal, hex;
for (it = input.begin(); it != input.end(); it++)
@@ -1277,11 +1277,10 @@ string DeEscapeString(string &input)
switch (*it)
{
case '0':
- if (it + 3 <= input.end()) {
+ if (it + 2 <= input.end()) {
tmp[0] = it[1];
tmp[1] = it[2];
- tmp[2] = it[3];
- tmp[3] = 0;
+ tmp[2] = 0;
output += (char)strtol(tmp, 0, 8);
it += 2;
}
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 43bbfe366..2a6bc1990 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -40,7 +40,7 @@ string QuoteString(const string &Str,const char *Bad);
string DeQuoteString(const string &Str);
string DeQuoteString(string::const_iterator const &begin, string::const_iterator const &end);
-// unescape (\0XXX and \xXX) from a string
+// unescape (\0XX and \xXX) from a string
string DeEscapeString(string &input);
string SizeToStr(double Bytes);