Module: kamailio Branch: master Commit: 4bb099b046939b85e1827b804167a51ef4bc00c4 URL: https://github.com/kamailio/kamailio/commit/4bb099b046939b85e1827b804167a51ef4bc00c4
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2020-11-09T13:10:43+01:00 sctp: memcpy field data to avoid unaligned access warning - GH #2543 --- Modified: src/modules/sctp/sctp_server.c --- Diff: https://github.com/kamailio/kamailio/commit/4bb099b046939b85e1827b804167a51ef4bc00c4.diff Patch: https://github.com/kamailio/kamailio/commit/4bb099b046939b85e1827b804167a51ef4bc00c4.patch --- diff --git a/src/modules/sctp/sctp_server.c b/src/modules/sctp/sctp_server.c index d58c96fad6..3bc0c6a4e4 100644 --- a/src/modules/sctp/sctp_server.c +++ b/src/modules/sctp/sctp_server.c @@ -2258,6 +2258,7 @@ static int sctp_handle_notification(struct socket_info *si, { union sctp_notification *snp; char su_buf[SU2A_MAX_STR_SIZE]; + struct sockaddr_storage sa_storage; #define SNOT DBG #define ERR_LEN_TOO_SMALL(length, val, bind_addr, from_su, text) \ @@ -2311,8 +2312,9 @@ static int sctp_handle_notification(struct socket_info *si, sctp_paddr_change_state2s(snp->sn_paddr_change.spc_state), snp->sn_paddr_change.spc_state, &snp->sn_paddr_change.spc_aaddr); - strcpy(su_buf, su2a((union sockaddr_union *)&snp->sn_paddr_change - .spc_aaddr, + memcpy(&sa_storage, &snp->sn_paddr_change.spc_aaddr, + sizeof(snp->sn_paddr_change.spc_aaddr)); + strcpy(su_buf, su2a((union sockaddr_union *)&sa_storage, sizeof(snp->sn_paddr_change.spc_aaddr))); SNOT("sctp notification from %s on %.*s:%d: SCTP_PEER_ADDR_CHANGE" ": %s: %s: assoc_id %d \n", _______________________________________________ Kamailio (SER) - Development Mailing List [email protected] https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
