Avoid memcpy(X,NULL,0) UB

This commit is contained in:
angt
2016-02-29 15:35:04 +00:00
parent c5dc443986
commit a1ce4740b4

5
mud.c
View File

@@ -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(