[asterisk-commits] func aes: fix misuse of strlen on binary data (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 21 15:16:28 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: func_aes: fix misuse of strlen on binary data
......................................................................


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
---
M funcs/func_aes.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/funcs/func_aes.c b/funcs/func_aes.c
index 9347b6f..d80636f 100644
--- a/funcs/func_aes.c
+++ b/funcs/func_aes.c
@@ -146,7 +146,7 @@
 	}
 
 	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);
 	}

-- 
To view, visit https://gerrit.asterisk.org/2437
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If686b5d570473eb926693c73461177b35b13b186
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Gianluca Merlo <gianluca.merlo at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list