[asterisk-commits] mjordan: branch 12 r404843 - in /branches/12: res/ tests/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 3 15:10:02 CST 2014


Author: mjordan
Date: Fri Jan  3 15:09:59 2014
New Revision: 404843

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404843
Log:
res_pjsip_authenticator_digest: Fix md5 hash buffer

An md5 hash is 32 bytes long. The char buffer must be at least 33 bytes to
avoid clobbering of the stack. This patch also fixes a potential clobbering
in test_utils.c.

Thanks to Andrew Nagy for reporting and testing this out in #asterisk-dev

Reported by: Andrew Nagy
Tested by: Andrew Nagy


Modified:
    branches/12/res/res_pjsip_authenticator_digest.c
    branches/12/tests/test_utils.c

Modified: branches/12/res/res_pjsip_authenticator_digest.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_authenticator_digest.c?view=diff&rev=404843&r1=404842&r2=404843
==============================================================================
--- branches/12/res/res_pjsip_authenticator_digest.c (original)
+++ branches/12/res/res_pjsip_authenticator_digest.c Fri Jan  3 15:09:59 2014
@@ -198,7 +198,7 @@
 {
 	struct ast_str *str = ast_str_alloca(256);
 	RAII_VAR(char *, eid, ao2_global_obj_ref(entity_id), ao2_cleanup);
-	char hash[32];
+	char hash[33];
 
 	ast_str_append(&str, 0, "%s", timestamp);
 	ast_str_append(&str, 0, ":%s", rdata->pkt_info.src_name);

Modified: branches/12/tests/test_utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/tests/test_utils.c?view=diff&rev=404843&r1=404842&r2=404843
==============================================================================
--- branches/12/tests/test_utils.c (original)
+++ branches/12/tests/test_utils.c Fri Jan  3 15:09:59 2014
@@ -202,7 +202,7 @@
 	ast_test_status_update(test, "Testing MD5 ...\n");
 
 	for (i = 0; i < ARRAY_LEN(tests); i++) {
-		char md5_hash[32];
+		char md5_hash[33];
 		ast_md5_hash(md5_hash, tests[i].input);
 		if (strcasecmp(md5_hash, tests[i].expected_output)) {
 			ast_test_status_update(test,




More information about the asterisk-commits mailing list