Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: srtp/crypto/cipher/aes_gcm_ossl.c

Issue 2129753002: Prevent stack-buffer-overflow with address sanitizer (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libsrtp@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: srtp/crypto/cipher/aes_gcm_ossl.c
diff --git a/srtp/crypto/cipher/aes_gcm_ossl.c b/srtp/crypto/cipher/aes_gcm_ossl.c
index dce2a337cb8dd234fbebe3ab6ee770cf629fff52..4bff8dbebc922a9df4dc186b70a08074ce0b7ddd 100644
--- a/srtp/crypto/cipher/aes_gcm_ossl.c
+++ b/srtp/crypto/cipher/aes_gcm_ossl.c
@@ -267,7 +267,9 @@ err_status_t aes_gcm_openssl_set_aad (aes_gcm_ctx_t *c, unsigned char *aad,
* Set dummy tag, OpenSSL requires the Tag to be set before
* processing AAD
*/
- EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, aad);
+ unsigned char dummy_tag[GCM_AUTH_TAG_LEN];
+ memset(dummy_tag, 0x0, GCM_AUTH_TAG_LEN);
+ EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, &dummy_tag);
tommi 2016/07/26 08:47:14 does sizeof(dummy_tag) have to match c->tag_len?
joachim 2016/07/26 09:08:38 Yes, but it has to be between 1 and 16 bytes (see
tommi 2016/07/26 09:45:09 Acknowledged.
rv = EVP_Cipher(&c->ctx, NULL, aad, aad_len);
if (rv != aad_len) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698