diff options
author | Gianluca Merlo <gianluca.merlo@gmail.com> | 2016-03-19 02:32:51 +0100 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-03-18 22:04:18 -0500 |
commit | 8f94f947f575630200b6602eda64b1172ecae101 (patch) | |
tree | 24f38edeb9a7c919c61d0a95b2b3c504f5adb76e | |
parent | 4aaf8f2ace38346db10289be867195e6a2a5d96c (diff) |
func_aes: fix misuse of strlen on binary data
The encryption code for AES_ENCRYPT evaluates the length of the data to
be encoded in base64 using strlen. The data is binary, thus the length
of it can be underestimated at the first NULL character.
Reuse the write pointer offset to evaluate it, instead.
ASTERISK-25857 #close
Change-Id: If686b5d570473eb926693c73461177b35b13b186
-rw-r--r-- | funcs/func_aes.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/funcs/func_aes.c b/funcs/func_aes.c index 9347b6f8e..d80636f6d 100644 --- a/funcs/func_aes.c +++ b/funcs/func_aes.c @@ -146,7 +146,7 @@ static int aes_helper(struct ast_channel *chan, const char *cmd, char *data, } if (encrypt) { /* if encrypting encode result to base64 */ - ast_base64encode(buf, (unsigned char *) tmp, strlen(tmp), len); + ast_base64encode(buf, (unsigned char *) tmp, tmpP - tmp, len); } else { memcpy(buf, tmp, len); } |