You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/06/23 14:58:05 UTC

[GitHub] [incubator-kvrocks] willshS commented on a diff in pull request #652: Fix Wrongly parsed the RESP empty/null array (#633)

willshS commented on code in PR #652:
URL: https://github.com/apache/incubator-kvrocks/pull/652#discussion_r905130235


##########
src/redis_request.cc:
##########
@@ -59,11 +59,15 @@ Status Request::Tokenize(evbuffer *input) {
         svr_->stats_.IncrInbondBytes(len);
         if (line[0] == '*') {
           try {
-            multi_bulk_len_ = std::stoull(std::string(line + 1, len-1));
+            multi_bulk_len_ = std::stoll(std::string(line + 1, len-1));
           } catch (std::exception &e) {
             free(line);
             return Status(Status::NotOK, "Protocol error: invalid multibulk length");
           }
+          if (multi_bulk_len_ <= 0) {

Review Comment:
   `state_ `is still `ArrayLen`, so it will read again and assign to `multi_bulk_len_`.   it's a good habit that to add the assignment `multi_bulk_len_`. Thank you



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org