Skip to content

Commit

Permalink
Do not check whether u8 value is greater than zero in LdapLayer.cpp (#…
Browse files Browse the repository at this point in the history
…1614)

This comparison is always true due to limited range of data type

Co-authored-by: Liu, An-Chi <phy.tiger@gmail.com>
  • Loading branch information
ol-imorozko and tigercosmos authored Oct 18, 2024
1 parent 2eb3fc6 commit bdc68bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Packet++/src/LdapLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ namespace pcpp

LdapSearchRequestLayer::SearchRequestScope LdapSearchRequestLayer::SearchRequestScope::fromUintValue(uint8_t value)
{
if (value >= 0 && value <= 2)
if (value <= 2)
{
return static_cast<LdapSearchRequestLayer::SearchRequestScope::Value>(value);
}
Expand All @@ -686,7 +686,7 @@ namespace pcpp

LdapSearchRequestLayer::DerefAliases LdapSearchRequestLayer::DerefAliases::fromUintValue(uint8_t value)
{
if (value >= 0 && value <= 3)
if (value <= 3)
{
return static_cast<LdapSearchRequestLayer::DerefAliases::Value>(value);
}
Expand Down

0 comments on commit bdc68bd

Please sign in to comment.