pespin has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/41840/1

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: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib90e6b5bc6c03cbbf40041463f3d05d85f55a68a
Gerrit-Change-Number: 41840
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to