mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 06:25:59 -07:00
add some safety checks to enet_packet_resize
Some checks failed
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Debug, macos-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Debug, ubuntu-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Debug, windows-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Release, macos-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Release, ubuntu-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Release, windows-latest) (push) Has been cancelled
Some checks failed
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Debug, macos-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Debug, ubuntu-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Debug, windows-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Release, macos-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Release, ubuntu-latest) (push) Has been cancelled
CMake / CMake ${{ matrix.os }} ${{ matrix.build_type }} (Release, windows-latest) (push) Has been cancelled
This commit is contained in:
parent
7083138fd4
commit
0b924c79ce
1 changed files with 8 additions and 3 deletions
5
packet.c
5
packet.c
|
@ -89,8 +89,13 @@ enet_packet_resize (ENetPacket * packet, size_t dataLength)
|
|||
if (newData == NULL)
|
||||
return -1;
|
||||
|
||||
if (packet -> data != NULL)
|
||||
{
|
||||
if (packet -> dataLength > 0)
|
||||
memcpy (newData, packet -> data, packet -> dataLength);
|
||||
|
||||
enet_free (packet -> data);
|
||||
}
|
||||
|
||||
packet -> data = newData;
|
||||
packet -> dataLength = dataLength;
|
||||
|
|
Loading…
Reference in a new issue