The check of addrlen >= sizeof(struct sockaddr) is too restrictive
and causes sa_family to not be saved in the case of AF_UNIX sockets
as the addrlen returned by the syscall may be only sizeof(short).
Individual checks per socket family are performed anyhow in the
switch case, making this safe.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
TP_code_pre(
sc_in(
memset(tp_locvar, 0, sizeof(*tp_locvar));
- if (addrlen < sizeof(struct sockaddr))
+ if (addrlen < sizeof(tp_locvar->sa_family))
goto skip_code;
(void) get_user(tp_locvar->sa_family, &uservaddr->sa_family);
switch (tp_locvar->sa_family) {
(void) get_user(tp_locvar->uaddr_len, upeer_addrlen); \
) \
sc_out( \
- if (tp_locvar->uaddr_len < sizeof(struct sockaddr)) \
+ if (tp_locvar->uaddr_len < sizeof(tp_locvar->sa_family)) \
goto skip_code; \
(void) get_user(tp_locvar->sa_family, &upeer_sockaddr->sa_family); \
switch (tp_locvar->sa_family) { \