Skip to content

Commit 59f4406

Browse files
committed
improve readablility
1 parent f2fe503 commit 59f4406

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

process/icmp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int ICMPPlugin::post_create(Flow &rec, const Packet &pkt)
6767
{
6868
if (pkt.ip_proto == IPPROTO_ICMP ||
6969
pkt.ip_proto == IPPROTO_ICMPV6) {
70-
if (pkt.payload_len < 2)
70+
if (pkt.payload_len < sizeof(RecordExtICMP::type_code))
7171
return 0;
7272

7373
auto ext = new RecordExtICMP();

process/icmp.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ struct RecordExtICMP : public RecordExt {
120120
auto *type_code = reinterpret_cast<const uint8_t *>(&this->type_code);
121121

122122
std::ostringstream out;
123-
out << "type=\"" << (int)type_code[0] << '"'
124-
<< ",code=\"" << (int)type_code[1] << '"';
123+
out << "type=\"" << static_cast<int>(type_code[0]) << '"'
124+
<< ",code=\"" << static_cast<int>(type_code[1]) << '"';
125125

126126
return out.str();
127127
}

0 commit comments

Comments
 (0)