summaryrefslogtreecommitdiffstats
path: root/drm/libdrmframework/plugins/forward-lock/internal-format
diff options
context:
space:
mode:
authorHung Nguyen <hung.nguyen@sonymobile.com>2012-06-05 13:19:53 +0200
committerJames Dong <jdong@google.com>2013-01-25 16:25:18 -0800
commit61eae44c393f47103e9cc58b3deb92ece49fcb51 (patch)
tree237db1bba4fc00fa46a1f23aaa2b69a6f15a6b9d /drm/libdrmframework/plugins/forward-lock/internal-format
parentbb9c2e1155d0a844f04aec981b44a9e562522fde (diff)
downloadframeworks_av-61eae44c393f47103e9cc58b3deb92ece49fcb51.zip
frameworks_av-61eae44c393f47103e9cc58b3deb92ece49fcb51.tar.gz
frameworks_av-61eae44c393f47103e9cc58b3deb92ece49fcb51.tar.bz2
Fixed bugs where the content of buffer holding keys was cleared using a wrong size in forward lock
Modified by James Dong <jdong@google.com> Change-Id: Iaacfc79b2b26bdee7046d8555e3b4e0bc224c3c5
Diffstat (limited to 'drm/libdrmframework/plugins/forward-lock/internal-format')
-rw-r--r--drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c6
-rw-r--r--drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c7
2 files changed, 9 insertions, 4 deletions
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c b/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c
index bb97abc..9d15835 100644
--- a/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c
+++ b/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c
@@ -245,7 +245,9 @@ static int FwdLockConv_DeriveKeys(FwdLockConv_Session_t *pSession) {
AES_KEY sessionRoundKeys;
unsigned char value[KEY_SIZE];
unsigned char key[KEY_SIZE];
- } *pData = malloc(sizeof *pData);
+ };
+ const size_t kSize = sizeof(struct FwdLockConv_DeriveKeys_Data);
+ struct FwdLockConv_DeriveKeys_Data *pData = malloc(kSize);
if (pData == NULL) {
status = FwdLockConv_Status_OutOfMemory;
} else {
@@ -268,7 +270,7 @@ static int FwdLockConv_DeriveKeys(FwdLockConv_Session_t *pSession) {
status = FwdLockConv_Status_OK;
}
}
- memset(pData, 0, sizeof pData); // Zero out key data.
+ memset(pData, 0, kSize); // Zero out key data.
free(pData);
}
return status;
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c b/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c
index 7ff3c00..43b9e98 100644
--- a/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c
+++ b/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c
@@ -174,7 +174,10 @@ static int FwdLockFile_DeriveKeys(FwdLockFile_Session_t * pSession) {
AES_KEY sessionRoundKeys;
unsigned char value[KEY_SIZE];
unsigned char key[KEY_SIZE];
- } *pData = malloc(sizeof *pData);
+ };
+
+ const size_t kSize = sizeof(struct FwdLockFile_DeriveKeys_Data);
+ struct FwdLockFile_DeriveKeys_Data *pData = malloc(kSize);
if (pData == NULL) {
result = FALSE;
} else {
@@ -202,7 +205,7 @@ static int FwdLockFile_DeriveKeys(FwdLockFile_Session_t * pSession) {
if (!result) {
errno = ENOSYS;
}
- memset(pData, 0, sizeof pData); // Zero out key data.
+ memset(pData, 0, kSize); // Zero out key data.
free(pData);
}
return result;