path: root/src
diff options
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-04-09 14:22:22 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-10 08:44:35 +0200
commita84db616737cda5dfc6e8590a29523dc08090f60 (patch)
tree2d2454fbc732d0a064f1d8accc84f00c34a1e328 /src
parentd154f8bda2e379a8a0e1c3712a9af6a9d97b7b97 (diff)
gprs: Add assertion for msg != NULL to bssgp_msgb_alloc (Coverity)
Currently out-of-memory is not handled by bssgp_msgb_alloc, leading to SEGV failures if msgb_alloc_headroom returns NULL. This commit adds an OSMO_ASSERT to catch this case, which improves the situation only slightly. But bssgp_msgb_alloc is used in many places without checking the return value, so just adding a conditional early NULL return would not fix the issue either. Fixes: Coverity CID 1293377 Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gb/gprs_bssgp_util.c b/src/gb/gprs_bssgp_util.c
index fe66f460..3c42e4d4 100644
--- a/src/gb/gprs_bssgp_util.c
+++ b/src/gb/gprs_bssgp_util.c
@@ -71,6 +71,10 @@ const char *bssgp_cause_str(enum gprs_bssgp_cause cause)
struct msgb *bssgp_msgb_alloc(void)
struct msgb *msg = msgb_alloc_headroom(4096, 128, "BSSGP");
+ /* TODO: Add handling of msg == NULL to this function and to all callers */
msgb_bssgph(msg) = msg->data;
return msg;