mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
lib: Fix illegal use of 0-length arrays
Found and confirmed to work by albert chin (china@thewrittenword.com) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
7b50dddb32
commit
74b3dd4630
@ -37,13 +37,19 @@ ssize_t msghdr_prep_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
|
||||
msg->msg_control = NULL;
|
||||
msg->msg_controllen = 0;
|
||||
}
|
||||
return 0;
|
||||
/*
|
||||
* C99 doesn't allow 0-length arrays
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
if (num_fds > INT8_MAX) {
|
||||
return -1;
|
||||
}
|
||||
if ((msg == NULL) || (cmsg_space > bufsize)) {
|
||||
return cmsg_space;
|
||||
/*
|
||||
* C99 doesn't allow 0-length arrays
|
||||
*/
|
||||
return MAX(cmsg_space, 1);
|
||||
}
|
||||
|
||||
msg->msg_control = buf;
|
||||
|
Loading…
Reference in New Issue
Block a user