Browse Source

BencodeParser: fixed parser failure due to the uninitialized variables

Tatsuhiro Tsujikawa 13 years ago
parent
commit
7176107414
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/BencodeParser.cc

+ 3 - 0
src/BencodeParser.cc

@@ -135,7 +135,10 @@ ssize_t BencodeParser::parseUpdate(const char* data, size_t size)
       if(rv < 0) {
         return rv;
       }
+      strLength_ = 0;
+      numConsumed_ = 0;
       runBeginCallback(STRUCT_DICT_KEY_T);
+      currentState_ = BENCODE_STRING_LEN;
       // Fall through
     }
     case BENCODE_STRING_LEN: {