Skip to content

Commit

Permalink
Fixed packet registration bug
Browse files Browse the repository at this point in the history
  • Loading branch information
st1vms committed Feb 23, 2023
1 parent d4e02ad commit fcc0f59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion binds/Android/JDBits/jdbits/src/main/cpp/src/dpacket.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void FreePacket(dpacket_t packet)
char RegisterPacket(packet_id_t packet_id, int *packet_format, size_t format_size)
{

if (packet_format == NULL || packet_id > PACKET_TABLE_SIZE || format_size > MAX_PACKET_FIELDS)
if (packet_format == NULL || packet_id >= PACKET_TABLE_SIZE || format_size == 0 || format_size > MAX_PACKET_FIELDS)
{
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dpacket.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void FreePacket(dpacket_t packet)
char RegisterPacket(packet_id_t packet_id, int *packet_format, size_t format_size)
{

if (packet_format == NULL || packet_id > PACKET_TABLE_SIZE || format_size > MAX_PACKET_FIELDS)
if (packet_format == NULL || packet_id >= PACKET_TABLE_SIZE || format_size == 0 || format_size > MAX_PACKET_FIELDS)
{
return 0;
}
Expand Down

0 comments on commit fcc0f59

Please sign in to comment.