[vino] Fix strict-aliasing warning in VNC authentication
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vino] Fix strict-aliasing warning in VNC authentication
- Date: Fri, 4 Mar 2011 09:22:14 +0000 (UTC)
commit 11b8c62866af01d569e2182324274a6e8d9dd18f
Author: David King <amigadave amigadave com>
Date: Thu Mar 3 21:59:08 2011 +0100
Fix strict-aliasing warning in VNC authentication
server/libvncserver/auth.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/server/libvncserver/auth.c b/server/libvncserver/auth.c
index 07e0b70..19d1de5 100644
--- a/server/libvncserver/auth.c
+++ b/server/libvncserver/auth.c
@@ -151,7 +151,10 @@ rfbAuthNewClient3_7(rfbClientPtr cl)
static void
rfbAuthNewClient3_3(rfbClientPtr cl)
{
- char buf[4 + CHALLENGESIZE];
+ union {
+ uint32_t authType;
+ char buf[4 + CHALLENGESIZE];
+ } auth;
int len, i;
for (i = 0; i < cl->screen->nSecurityTypes; i++)
@@ -166,14 +169,14 @@ rfbAuthNewClient3_3(rfbClientPtr cl)
switch (cl->screen->securityTypes [i]) {
case rfbVncAuth:
- *(uint32_t *)buf = Swap32IfLE(rfbVncAuth);
+ auth.authType = Swap32IfLE(rfbVncAuth);
vncRandomBytes(cl->authChallenge);
- memcpy(&buf[4], (char *)cl->authChallenge, CHALLENGESIZE);
+ memcpy(&(auth.buf[4]), (char *)cl->authChallenge, CHALLENGESIZE);
len = 4 + CHALLENGESIZE;
cl->state = RFB_AUTHENTICATION;
break;
case rfbNoAuth:
- *(uint32_t *)buf = Swap32IfLE(rfbNoAuth);
+ auth.authType = Swap32IfLE(rfbNoAuth);
len = 4;
cl->state = RFB_INITIALISATION;
break;
@@ -182,7 +185,7 @@ rfbAuthNewClient3_3(rfbClientPtr cl)
return;
}
- if (WriteExact(cl, buf, len) < 0) {
+ if (WriteExact(cl, auth.buf, len) < 0) {
rfbLogPerror("rfbAuthNewClient: write");
rfbCloseClient(cl);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]