sctp: avoid undefined behaviour and cleanup the code.
(cherry picked from commit 76e03cc940fed57d580b1d5c0605e8af2e14f05b)