Skip to content

Commit 9fe18b1

Browse files
committed
fix: Fix some false positive from PVS Studio.
It correctly warns about potentially dereferencing NULL chat in a log statement. However, chat can semantically never be NULL in that call, and it's just a defensive check. Still good to fix for clarity.
1 parent 7c44379 commit 9fe18b1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

other/docker/sources/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ if [ -f "$DOCKERDIR/dockerignore" ]; then
1818
cat "$DOCKERDIR/dockerignore" >>"$DOCKERDIR/$BUILD.Dockerfile.dockerignore"
1919
fi
2020

21-
docker build -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/$BUILD.Dockerfile" .
21+
docker build "${DOCKERFLAGS[@]}" -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/$BUILD.Dockerfile" .

toxcore/group_chats.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5560,12 +5560,12 @@ static int make_gc_handshake_packet(const GC_Chat *chat, const GC_Connection *gc
55605560
uint8_t request_type, uint8_t join_type, uint8_t *packet, size_t packet_size,
55615561
const Node_format *node)
55625562
{
5563-
if (packet_size != GC_MIN_ENCRYPTED_HS_PAYLOAD_SIZE + sizeof(Node_format)) {
5564-
LOGGER_FATAL(chat->log, "invalid packet size: %zu", packet_size);
5563+
if (chat == nullptr || gconn == nullptr || node == nullptr) {
55655564
return -1;
55665565
}
55675566

5568-
if (chat == nullptr || gconn == nullptr || node == nullptr) {
5567+
if (packet_size != GC_MIN_ENCRYPTED_HS_PAYLOAD_SIZE + sizeof(Node_format)) {
5568+
LOGGER_FATAL(chat->log, "invalid packet size: %zu", packet_size);
55695569
return -1;
55705570
}
55715571

0 commit comments

Comments
 (0)