diff options
author | Jo-Philipp Wich <jo@mein.io> | 2023-05-27 10:10:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-27 10:10:45 +0200 |
commit | b213bd120d5532cd3e4e40160b18c18e2aca37c7 (patch) | |
tree | 1ccd1369420701cf102b8b20580a1b892a7920f9 /lib/ubus.c | |
parent | b0baf043e64ca4d6cf80f371c23ec8581ecd5d59 (diff) | |
parent | 2b4346bfdc6769f8d6d9c680c7fac94f12cfbfae (diff) |
Merge pull request #150 from nbd168/misc-improvements
Diffstat (limited to 'lib/ubus.c')
-rw-r--r-- | lib/ubus.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -393,7 +393,7 @@ blob_to_ucv(uc_vm_t *vm, struct blob_attr *attr, bool table, const char **name) return ucv_double_new(v.d); case BLOBMSG_TYPE_STRING: - return ucv_string_new(data); + return ucv_string_new_length(data, len - 1); case BLOBMSG_TYPE_ARRAY: return blob_array_to_ucv(vm, data, len, false); @@ -444,7 +444,8 @@ ucv_to_blob(const char *name, uc_value_t *val, struct blob_buf *blob) break; case UC_STRING: - blobmsg_add_string(blob, name, ucv_string_get(val)); + blobmsg_add_field(blob, BLOBMSG_TYPE_STRING, name, + ucv_string_get(val), ucv_string_length(val) + 1); break; case UC_ARRAY: |