diff options
Diffstat (limited to 'test/mock/mock_aucodec.c')
-rw-r--r-- | test/mock/mock_aucodec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/mock/mock_aucodec.c b/test/mock/mock_aucodec.c index c923665..fd91721 100644 --- a/test/mock/mock_aucodec.c +++ b/test/mock/mock_aucodec.c @@ -49,6 +49,9 @@ static int mock_l16_decode(struct audec_state *st, if (!buf || !len || !sampv) return EINVAL; + if (len < 2) + return EINVAL; + if (*sampc < len/2) return ENOMEM; @@ -61,7 +64,7 @@ static int mock_l16_decode(struct audec_state *st, return EPROTO; } - len /= 2; + len = len/2 - 2; while (len--) *sampv++ = ntohs(*p++); |