aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2020-05-19 09:44:49 +0200
committerosmith <osmith@sysmocom.de>2020-05-20 06:05:38 +0000
commit12f93be6073ed89055862baafbfe0e08e50ed17a (patch)
tree5a57b094f99e70cb036b759a27dd4717bb0345c8
parentcf70aa0c40c574c32b832454f725cc37459c5d8d (diff)
gsmtap_makemsg_ex: NULL for unknown chan_type
-rw-r--r--src/gsmtap_util.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 9a0ac027..8674f1c1 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -169,7 +169,8 @@ void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype,
* \param[in] snr Signal/Noise Ratio (SNR)
* \param[in] data Pointer to data buffer
* \param[in] len Length of \ref data
- * \return dynamically allocated message buffer containing data
+ * \return dynamically allocated message buffer containing data,
+ * or NULL for unknown chan_type
*
* This function will allocate a new msgb and fill it with a GSMTAP
* header containing the information
@@ -182,6 +183,9 @@ struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t
struct gsmtap_hdr *gh;
uint8_t *dst;
+ if (chan_type == GSMTAP_CHANNEL_UNKNOWN)
+ return NULL;
+
msg = msgb_alloc(sizeof(*gh) + len, "gsmtap_tx");
if (!msg)
return NULL;