aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libucl
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-05 12:09:42 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-05 12:41:40 +0100
commit22bac56f258e2afcda6d2104fc5e2aaedf8c123b (patch)
tree0c6b8c77671306718da14ea11002027ddaff643a /contrib/libucl
parentce8577d636b2c8f1039133fb4e80da6e2672ca69 (diff)
downloadrspamd-22bac56f258e2afcda6d2104fc5e2aaedf8c123b.tar.gz
rspamd-22bac56f258e2afcda6d2104fc5e2aaedf8c123b.zip
[Minor] Sync from libucl
Diffstat (limited to 'contrib/libucl')
-rw-r--r--contrib/libucl/ucl_msgpack.c24
-rw-r--r--contrib/libucl/ucl_sexp.c1
2 files changed, 20 insertions, 5 deletions
diff --git a/contrib/libucl/ucl_msgpack.c b/contrib/libucl/ucl_msgpack.c
index 96f4809f8..bd7c3a1ce 100644
--- a/contrib/libucl/ucl_msgpack.c
+++ b/contrib/libucl/ucl_msgpack.c
@@ -1423,6 +1423,10 @@ ucl_msgpack_parse_int (struct ucl_parser *parser,
int16_t iv16;
int32_t iv32;
int64_t iv64;
+ uint16_t uiv16;
+ uint32_t uiv32;
+ uint64_t uiv64;
+
if (len > remain) {
return -1;
@@ -1455,7 +1459,9 @@ ucl_msgpack_parse_int (struct ucl_parser *parser,
len = 2;
break;
case msgpack_uint16:
- obj->value.iv = FROM_BE16 (*(uint16_t *)pos);
+ memcpy (&uiv16, pos, sizeof (uiv16));
+ uiv16 = FROM_BE16 (uiv16);
+ obj->value.iv = uiv16;
len = 2;
break;
case msgpack_int32:
@@ -1465,7 +1471,9 @@ ucl_msgpack_parse_int (struct ucl_parser *parser,
len = 4;
break;
case msgpack_uint32:
- obj->value.iv = FROM_BE32 (*(uint32_t *)pos);
+ memcpy(&uiv32, pos, sizeof(uiv32));
+ uiv32 = FROM_BE32(uiv32);
+ obj->value.iv = uiv32;
len = 4;
break;
case msgpack_int64:
@@ -1475,7 +1483,9 @@ ucl_msgpack_parse_int (struct ucl_parser *parser,
len = 8;
break;
case msgpack_uint64:
- obj->value.iv = FROM_BE64 (*(uint64_t *)pos);
+ memcpy(&uiv64, pos, sizeof(uiv64));
+ uiv64 = FROM_BE64(uiv64);
+ obj->value.iv = uiv64;
len = 8;
break;
default:
@@ -1498,6 +1508,7 @@ ucl_msgpack_parse_float (struct ucl_parser *parser,
uint32_t i;
float f;
} d;
+ uint64_t uiv64;
if (len > remain) {
return -1;
@@ -1507,13 +1518,16 @@ ucl_msgpack_parse_float (struct ucl_parser *parser,
switch (fmt) {
case msgpack_float32:
- d.i = FROM_BE32 (*(uint32_t *)pos);
+ memcpy(&d.i, pos, sizeof(d.i));
+ d.i = FROM_BE32(d.i);
/* XXX: can be slow */
obj->value.dv = d.f;
len = 4;
break;
case msgpack_float64:
- obj->value.iv = FROM_BE64 (*(uint64_t *)pos);
+ memcpy(&uiv64, pos, sizeof(uiv64));
+ uiv64 = FROM_BE64(uiv64);
+ obj->value.iv = uiv64;
len = 8;
break;
default:
diff --git a/contrib/libucl/ucl_sexp.c b/contrib/libucl/ucl_sexp.c
index c4ad75a18..1ad93d234 100644
--- a/contrib/libucl/ucl_sexp.c
+++ b/contrib/libucl/ucl_sexp.c
@@ -26,6 +26,7 @@
#include "config.h"
#endif
+#include <ucl.h>
#include "ucl.h"
#include "ucl_internal.h"
#include "utlist.h"