summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gsm/gsm0808_utils.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 054372aa..b4bb8789 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -200,11 +200,10 @@ int gsm0808_dec_speech_codec(struct gsm0808_speech_codec *sc,
header = *elem;
- /* Malformed elements */
+ /* An extended codec type needs at least two fields,
+ * bail if the input data length is not sufficient. */
if ((header & 0x0F) == 0x0F && len < 2)
return -EINVAL;
- else if ((header & 0x0F) != 0x0F && len < 1)
- return -EINVAL;
elem++;
len--;