glx: Fix mask truncation in __glXGetAnswerBuffer [CVE-2014-8093 6/6]

On a system where sizeof(unsigned) != sizeof(intptr_t), the unary
bitwise not operation will result in a mask that clears all high bits
from temp_buf in the expression:
        temp_buf = (temp_buf + mask) & ~mask;

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7e7630bbb7)
Signed-off-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Robert Morell 2014-11-12 18:51:43 -08:00 committed by Julien Cristau
parent 912df16404
commit 73b1880eb3
1 changed files with 1 additions and 1 deletions

View File

@ -73,7 +73,7 @@ __glXGetAnswerBuffer(__GLXclientState * cl, size_t required_size,
void *local_buffer, size_t local_size, unsigned alignment)
{
void *buffer = local_buffer;
const unsigned mask = alignment - 1;
const intptr_t mask = alignment - 1;
if (local_size < required_size) {
size_t worst_case_size;