From 10376b13f597bd29ead952e35c2499d7e52f3ad9 Mon Sep 17 00:00:00 2001 From: Daniel Thayer Date: Tue, 13 Nov 2012 15:48:25 -0600 Subject: [PATCH] Portability improvement (data alignment issues) --- src/bro.bif | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bro.bif b/src/bro.bif index 76fe5f6fa7..8dad05b24d 100644 --- a/src/bro.bif +++ b/src/bro.bif @@ -2716,8 +2716,9 @@ function bytestring_to_double%(s: string%): double return new Val(0.0, TYPE_DOUBLE); } - double d = ntohd( *(double *)s->Bytes() ); - return new Val(d, TYPE_DOUBLE); + double d; + memcpy(&d, s->Bytes(), sizeof(double)); + return new Val(ntohd(d), TYPE_DOUBLE); %} ## Converts a reverse pointer name to an address. For example,