From f8a342c350c3045a78be2fde1dad44c0d91fa7bf Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 21 Jul 2010 03:14:01 +0800 Subject: [PATCH] gsm_7bit_decode: rtext does not hold a null byte, reduce the size I have added the + 1 as I thought rtext will hold a terminating null byte but it will not. --- src/gsm_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsm_utils.c b/src/gsm_utils.c index 1a7ba0e4d..37b4df6a6 100644 --- a/src/gsm_utils.c +++ b/src/gsm_utils.c @@ -52,7 +52,7 @@ int gsm_7bit_decode(char *text, const uint8_t *user_data, uint8_t length) int i = 0; int l = 0; int septet_l = (length * 8) / 7; - uint8_t *rtext = calloc(septet_l + 1, sizeof(uint8_t)); + uint8_t *rtext = calloc(septet_l, sizeof(uint8_t)); uint8_t tmp; /* FIXME: We need to account for user data headers here */