mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
sd-varlink: refuse accepting more than 253 fds to send along with a Varlink message
253 is the max number of fds one can send at once on a Linux AF_UNIX socket. Hence refuse to send more early.
This commit is contained in:
@@ -3112,8 +3112,8 @@ _public_ int sd_varlink_push_fd(sd_varlink *v, int fd) {
|
||||
if (!v->allow_fd_passing_output)
|
||||
return -EPERM;
|
||||
|
||||
if (v->n_pushed_fds >= INT_MAX)
|
||||
return -ENOMEM;
|
||||
if (v->n_pushed_fds >= SCM_MAX_FD) /* Kernel doesn't support more than 253 fds per message, refuse early hence */
|
||||
return -ENOBUFS;
|
||||
|
||||
if (!GREEDY_REALLOC(v->pushed_fds, v->n_pushed_fds + 1))
|
||||
return -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user