pespin has submitted this change. (
https://gerrit.osmocom.org/c/libosmocore/+/41840?usp=email )
Change subject: osmo_io: Validate msghdr!=NULL after allocation
......................................................................
osmo_io: Validate msghdr!=NULL after allocation
Related: Coverity CID#556925
Change-Id: Ib90e6b5bc6c03cbbf40041463f3d05d85f55a68a
---
M src/core/osmo_io_poll.c
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index c37d436..b861675 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -106,6 +106,11 @@
}
msghdr = iofd_msghdr_alloc(iofd, action, NULL, iofd->cmsg_size);
+ if (!msghdr) {
+ LOGPIO(iofd, LOGL_ERROR, "Could not allocate msghdr for
reading\n");
+ OSMO_ASSERT(0);
+ }
+
for (idx = 0; idx < msghdr->io_len; idx++) {
msghdr->iov[idx].iov_base = msghdr->msg[idx]->tail;
msghdr->iov[idx].iov_len =
msgb_tailroom(msghdr->msg[idx]);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41840?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib90e6b5bc6c03cbbf40041463f3d05d85f55a68a
Gerrit-Change-Number: 41840
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>