[sms] Fix the length of the of the outgoing data...
The returned length should be right now. The test case
is passing.
diff --git a/src/gsm_utils.c b/src/gsm_utils.c
index 47fb247..97a81b1 100644
--- a/src/gsm_utils.c
+++ b/src/gsm_utils.c
@@ -49,8 +49,9 @@
int i;
u_int8_t d_off = 0, b_off = 0;
const int length = strlen(data);
- char *result = malloc(length + 1);
- memset(result, 0, length + 1);
+ *out_length = (length * 8)/7;
+ u_int8_t *result = malloc(*out_length);
+ memset(result, 0, *out_length);
for (i = 0; i < length; ++i) {
u_int8_t first = (data[i] & 0x7f) << b_off;
@@ -68,7 +69,5 @@
}
}
- *out_length = d_off + 1;
-
return result;
}