From d8a0e374a64b4af48a19d43b9bb44e92791dc0bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Tue, 24 Jan 2006 12:24:40 +0000 Subject: [PATCH] In translate24to32, only read 3 bytes from data buffer. If we are reading 4 bytes, we are reading beyond the buffer. Fixes valgrind warnings. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1039 423420c4-83ab-492f-b58f-81f9feb106b5 --- xwin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xwin.c b/xwin.c index 09a2351..c98ee22 100644 --- a/xwin.c +++ b/xwin.c @@ -802,9 +802,10 @@ translate24to32(const uint8 * data, uint8 * out, uint8 * end) #else REPEAT4 ( - *((uint32 *) out) = *((uint32 *) data); - out += 4; - data += 3; + /* Only read 3 bytes. Reading 4 bytes means reading beyound buffer. */ + *((uint32 *) out) = *((uint16 *) data) + (*((uint8 *) data + 2) << 16); + out += 4; + data += 3; ) #endif /* *INDENT-ON* */