summaryrefslogtreecommitdiffhomepage
path: root/lib/ubus.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-09-23 18:45:48 +0200
committerJo-Philipp Wich <jo@mein.io>2021-09-23 18:45:48 +0200
commite43b751aab997c5e74a0712f7569d90bd3d6b429 (patch)
tree367392c59f9a8bc017e8446ba6330e76fd6b3f8a /lib/ubus.c
parentacd3c7691bda056d367adb18a62bf61eaea016db (diff)
ubus: fix handling signed 16bit and 32bit integers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib/ubus.c')
-rw-r--r--lib/ubus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ubus.c b/lib/ubus.c
index 14e62de..a66b011 100644
--- a/lib/ubus.c
+++ b/lib/ubus.c
@@ -96,10 +96,10 @@ uc_blob_to_json(uc_vm_t *vm, struct blob_attr *attr, bool table, const char **na
return ucv_boolean_new(*(uint8_t *)data);
case BLOBMSG_TYPE_INT16:
- return ucv_int64_new((int64_t)be16_to_cpu(*(uint16_t *)data));
+ return ucv_int64_new((int16_t)be16_to_cpu(*(uint16_t *)data));
case BLOBMSG_TYPE_INT32:
- return ucv_int64_new((int64_t)be32_to_cpu(*(uint32_t *)data));
+ return ucv_int64_new((int32_t)be32_to_cpu(*(uint32_t *)data));
case BLOBMSG_TYPE_INT64:
return ucv_uint64_new(be64_to_cpu(*(uint64_t *)data));