mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
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
This commit is contained in:
committed by
Richard Mudgett
parent
4aaf8f2ace
commit
8f94f947f5
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user