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;
|
ssize_t encoded;
|
||||||
|
|
||||||
if (sock->remote.callsign[0] == '\0') {
|
if (sock->iface == NULL) {
|
||||||
goto error_nopeer;
|
errno = ENETDOWN;
|
||||||
|
|
||||||
|
goto error_noif;
|
||||||
}
|
}
|
||||||
|
|
||||||
params.flags = (1 << PATTY_AX25_PARAM_CLASSES)
|
params.flags = (1 << PATTY_AX25_PARAM_CLASSES)
|
||||||
|
@ -558,7 +560,7 @@ ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock,
|
||||||
encoded);
|
encoded);
|
||||||
|
|
||||||
error_frame_encode_xid:
|
error_frame_encode_xid:
|
||||||
error_nopeer:
|
error_noif:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue