Explorar o código

BencodeParser: fixed parser failure due to the uninitialized variables

Tatsuhiro Tsujikawa %!s(int64=13) %!d(string=hai) anos
pai
achega
7176107414
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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: {