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:
parent
fe72380888
commit
e90b5803bf
1 changed files with 5 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue