added compile option to use sanitizer and already fixed a few misalignment errors with it

This commit is contained in:
csoler 2019-05-11 22:25:02 +02:00
parent 941df6120a
commit 6a18e242bb
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
8 changed files with 35 additions and 12 deletions

View file

@ -827,9 +827,10 @@ int decodeCompactPeerId(struct sockaddr_in *addr, char *enc, int len)
memset(addr, 0, sizeof(struct sockaddr_in));
uint32_t *ip = (uint32_t *) (enc);
//uint32_t *ip = (uint32_t *) (enc);
uint16_t *port = (uint16_t *) (&enc[4]);
addr->sin_addr.s_addr = (*ip);
memcpy(& addr->sin_addr.s_addr, enc, sizeof(in_addr_t)); // aligned version of "addr->sin_addr.s_addr = (*ip); "
addr->sin_port = (*port);
addr->sin_family = AF_INET;