ussd: Tweak buffer size

This commit is contained in:
Denis Kenzior 2010-09-15 12:11:08 -05:00
parent 41a55beef3
commit c97489a161
1 changed files with 2 additions and 2 deletions

View File

@ -72,9 +72,9 @@ static const unsigned char *ucs2_gsm_to_packed(const char *content,
unsigned char *gsm;
long written;
unsigned char *packed;
unsigned char buf[182 * 4]; /* 182 USSD chars * 2 (UCS2) * 2 (hex) */
unsigned char buf[182 * 2]; /* 182 USSD chars * 2 (UCS2) */
if (strlen(content) > sizeof(buf))
if (strlen(content) > sizeof(buf) * 2) /* Hex, 2 chars / byte */
return NULL;
decoded = decode_hex_own_buf(content, -1, &len, 0, buf);