aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-05-11 15:10:54 -0700
committerGuy Harris <guy@alum.mit.edu>2015-05-11 22:11:21 +0000
commit8045cd648140cf56ef8b9c02f1015b8807082333 (patch)
treeac691d24883bba995258cd058b6c8276dfdf015c /epan
parente3e5d3032eea06ea00f7028cb35f559bfd2af186 (diff)
Do not assume the data field of an address structure is an aligned pointer.
There is *no* guarantee that it's aligned on a 4-byte boundary, and there is *no* guarantee that you can safely dereference an unaligned pointer. See bug 11172 for a crash on Solaris/SPARC caused by those assumptions both being false. Change-Id: I30d97aebd42283545f5b8f6d50fa09c5b476ec47 Reviewed-on: https://code.wireshark.org/review/8412 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-ssl-utils.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index 932dd40ba1..b2ac8b733a 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -42,6 +42,7 @@
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
#include <wsutil/report_err.h>
+#include <wsutil/pint.h>
#include "packet-x509af.h"
#include "packet-x509if.h"
#include "packet-ssl-utils.h"
@@ -4127,16 +4128,16 @@ ssl_private_key_hash (gconstpointer v)
{
const SslService *key;
guint l, hash, len ;
- const guint* cur;
+ const guint8 *cur;
key = (const SslService *)v;
hash = key->port;
len = key->addr.len;
hash |= len << 16;
- cur = (const guint*) key->addr.data;
+ cur = (const guint8 *) key->addr.data;
- for (l=4; (l<len); l+=4, cur++)
- hash = hash ^ (*cur);
+ for (l=4; (l<len); l+=4, cur+=4)
+ hash = hash ^ pntoh32(cur);
return hash;
}