summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-12-05 23:30:31 +0100
committerHarald Welte <laforge@gnumonks.org>2018-12-10 17:06:30 +0000
commit6adffb957349bc1ca75e49a20cbd05f06e62d668 (patch)
tree6a68c105f3fc4016992237950da2b6ce4a0f094c
parentea2a0ab041524bb651d488ea1eddda0cc3d9e895 (diff)
gsm48_mi_to_string(): do not read from zero length input buffer
Change-Id: I12cada7c2c5187146ca5a33d1ebfefb4cad65632
-rw-r--r--src/gsm/gsm48.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index af3e14c5..190622ff 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -655,7 +655,7 @@ int gsm48_mi_to_string(char *string, const int str_len, const uint8_t *mi,
uint8_t mi_type;
uint32_t tmsi;
- mi_type = mi[0] & GSM_MI_TYPE_MASK;
+ mi_type = (mi && mi_len) ? (mi[0] & GSM_MI_TYPE_MASK) : GSM_MI_TYPE_NONE;
switch (mi_type) {
case GSM_MI_TYPE_TMSI: