Skip to content

Commit

Permalink
Fix for cmds shorter than 4 generating longer pckt (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
egecetin authored Nov 7, 2023
1 parent f6c8acc commit cfb1e35
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Packet++/src/FtpLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ namespace pcpp
{
std::stringstream oss;
for (size_t idx = 0; idx < 4; ++idx)
oss << char((int(code) >> (8 * idx)) & UINT8_MAX);
{
char val = (uint64_t(code) >> (8 * idx)) & UINT8_MAX;
if (val) // Dont push if it is a null character
{
oss << val;
}
}
return oss.str();
}

Expand Down

0 comments on commit cfb1e35

Please sign in to comment.