diff options
Diffstat (limited to 'media/libmedia/IHDCP.cpp')
-rw-r--r-- | media/libmedia/IHDCP.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/media/libmedia/IHDCP.cpp b/media/libmedia/IHDCP.cpp index 493f5a4..3b42267 100644 --- a/media/libmedia/IHDCP.cpp +++ b/media/libmedia/IHDCP.cpp @@ -175,8 +175,19 @@ status_t BnHDCP::onTransact( case HDCP_ENCRYPT: { size_t size = data.readInt32(); + size_t bufSize = 2 * size; + + // watch out for overflow + void *inData = NULL; + if (bufSize > size) { + inData = malloc(bufSize); + } + + if (inData == NULL) { + reply->writeInt32(ERROR_OUT_OF_RANGE); + return OK; + } - void *inData = malloc(2 * size); void *outData = (uint8_t *)inData + size; data.read(inData, size); |