]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/strutl.cc
* merged latest fixes from debian-sid
[apt.git] / apt-pkg / contrib / strutl.cc
index a97dd30e592d96fcd6993cb816a8f4ea76d14429..ab2da2d9af11a9b21ed9930b5ec76869754efef1 100644 (file)
@@ -1240,12 +1240,12 @@ bool CheckDomainList(const string &Host,const string &List)
    return false;
 }
                                                                        /*}}}*/
-// ProcessEscapeSequences                                              /*{{{*/
+// DeEscapeString - unescape (\0XX and \xXX) from a string             /*{{{*/
 // ---------------------------------------------------------------------
-/*  */
-string DeEscapeString(string &input)
+/* */
+string DeEscapeString(const 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;
             }
@@ -1297,7 +1296,6 @@ string DeEscapeString(string &input)
             break;
          default:
             // FIXME: raise exception here?
-            std::cerr << "lala" << *it << endl;
             break;
       }
    }