Avoid memcpy(X,NULL,0) UB
This commit is contained in:
5
mud.c
5
mud.c
@@ -350,6 +350,9 @@ int mud_peer (struct mud *mud, const char *host, const char *port)
|
||||
struct sock *sock;
|
||||
struct sockaddr_storage addr;
|
||||
|
||||
if (!p->ai_addr)
|
||||
continue;
|
||||
|
||||
memcpy(&addr, p->ai_addr, p->ai_addrlen);
|
||||
|
||||
for (sock = mud->sock; sock; sock = sock->next)
|
||||
@@ -518,6 +521,8 @@ int mud_encrypt (struct mud *mud, uint64_t nonce,
|
||||
|
||||
mud_write48(npub, nonce);
|
||||
memcpy(dst, npub, 6);
|
||||
|
||||
if (src)
|
||||
memcpy(dst+6, src, ad_size);
|
||||
|
||||
crypto_aead_aes256gcm_encrypt_afternm(
|
||||
|
||||
Reference in New Issue
Block a user