Skip to content

Commit 4d5b397

Browse files
authored
Sainity Check for Protobuf parser (OpenAtomFoundation#831)
1 parent b990da0 commit 4d5b397

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pika_repl_client_conn.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ int PikaReplClientConn::DealMessage() {
4848
::google::protobuf::io::ArrayInputStream input(rbuf_ + cur_pos_ - header_len_, header_len_);
4949
::google::protobuf::io::CodedInputStream decoder(&input);
5050
decoder.SetTotalBytesLimit(g_pika_conf->max_conn_rbuf_size(), g_pika_conf->max_conn_rbuf_size());
51-
bool success = response->ParseFromCodedStream(&decoder);
51+
bool success = response->ParseFromCodedStream(&decoder) && decoder.ConsumedEntireMessage();
5252
if (!success) {
53-
LOG(WARNING) << "ParseFromArray FAILED! rbuf_len: " << rbuf_len_ << " header_len: " << header_len_;
53+
LOG(WARNING) << "ParseFromArray FAILED! " << " msg_len: " << header_len_;
5454
g_pika_server->SyncError();
5555
return -1;
5656
}

0 commit comments

Comments
 (0)