Add validation to patty_ax25_sock_send_xid()

Changes:

    * Make patty_ax25_sock_send_xid() set ENETDOWN when no network
      interface is associated with a sock
This commit is contained in:
XANTRONIX Development 2020-07-24 19:48:22 -04:00 committed by XANTRONIX Industrial
parent fe72380888
commit e90b5803bf

View file

@ -529,8 +529,10 @@ ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock,
ssize_t encoded;
if (sock->remote.callsign[0] == '\0') {
goto error_nopeer;
if (sock->iface == NULL) {
errno = ENETDOWN;
goto error_noif;
}
params.flags = (1 << PATTY_AX25_PARAM_CLASSES)
@ -558,7 +560,7 @@ ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock,
encoded);
error_frame_encode_xid:
error_nopeer:
error_noif:
return -1;
}