mirror of
https://github.com/EndPositive/slipstream.git
synced 2025-10-08 12:25:04 +00:00
Initialize encoding/decoding buffers with null pointers
closes #1 > the caller has no way to know if they need to free it or not while this is not necessarily true--the buffer is only allocated on succesful return codes--it is indeed better practice to ensure the pointers are nullified. This prevents future accidental mal-use leading to corruption when freeing an uninitialized pointer.
This commit is contained in:
parent
3ada0c8059
commit
c2386d344a
3 changed files with 7 additions and 3 deletions
|
|
@ -91,6 +91,8 @@ ssize_t client_encode_segment(dns_packet_t* packet, size_t* packet_len, const un
|
|||
}
|
||||
|
||||
ssize_t client_encode(void* slot_p, void* callback_ctx, unsigned char** dest_buf, const unsigned char* src_buf, size_t src_buf_len, size_t* segment_len, struct sockaddr_storage* peer_addr, struct sockaddr_storage* local_addr) {
|
||||
*dest_buf = NULL;
|
||||
|
||||
// optimize path for single segment
|
||||
if (src_buf_len <= *segment_len) {
|
||||
#ifdef NOENCODE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue