1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

fixup: check for NULL pointers

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2015-01-06 15:56:16 -08:00 committed by Jeremy Allison
parent 57300bbf5e
commit 3b1cb9385a

View File

@ -40,7 +40,7 @@ ssize_t msghdr_prep_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
if (num_fds > INT8_MAX) {
return -1;
}
if (cmsg_space > bufsize) {
if ((msg == NULL) || (cmsg_space > bufsize)) {
return cmsg_space;
}
@ -167,7 +167,7 @@ size_t msghdr_extract_fds(struct msghdr *msg, int *fds, size_t fds_size)
num_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
if ((num_fds != 0) && (fds_size >= num_fds)) {
if ((num_fds != 0) && (fds != NULL) && (fds_size >= num_fds)) {
memcpy(fds, CMSG_DATA(cmsg), num_fds * sizeof(int));
}