From ef737aa7311f96d400218e7deecbbeac789d9384 Mon Sep 17 00:00:00 2001 From: Lokesh Date: Mon, 12 Aug 2019 15:53:53 +0530 Subject: [PATCH] Fix to store only required bytes of BLE payload into DB Put number of bytes to be stored instead of '-1'. As -1 continues untill a NULL character is encountered. Change-Id: Iec025a35f8e610a92c9ae5ef39412bf450d6f524 Signed-off-by: Lokesh --- ua-daemon/src/ua-manager-device-db.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ua-daemon/src/ua-manager-device-db.c b/ua-daemon/src/ua-manager-device-db.c index 311ff5e..2f9f182 100644 --- a/ua-daemon/src/ua-manager-device-db.c +++ b/ua-daemon/src/ua-manager-device-db.c @@ -487,11 +487,11 @@ int _ua_device_db_insert_device_info(int user_id, error_code, handle_error); DB_ACTION(sqlite3_bind_int(stmt, 9, dev_info->discriminant), error_code, handle_error); - DB_ACTION(sqlite3_bind_text(stmt, 10, &(dev_info->payload.service_id), -1, SQLITE_TRANSIENT), + DB_ACTION(sqlite3_bind_text(stmt, 10, &(dev_info->payload.service_id), 1, SQLITE_TRANSIENT), + error_code, handle_error); // fourth parameter is number of bytes, set to 1 to store one byte + DB_ACTION(sqlite3_bind_text(stmt, 11, &(dev_info->payload.purpose), 1, SQLITE_TRANSIENT), error_code, handle_error); - DB_ACTION(sqlite3_bind_text(stmt, 11, &(dev_info->payload.purpose), -1, SQLITE_TRANSIENT), - error_code, handle_error); - DB_ACTION(sqlite3_bind_text(stmt, 12, dev_info->payload.duid, -1, SQLITE_TRANSIENT), + DB_ACTION(sqlite3_bind_text(stmt, 12, dev_info->payload.duid, UAM_BLE_PAYLOAD_DUID_LEN + 1, SQLITE_TRANSIENT), error_code, handle_error); DB_ACTION(sqlite3_bind_int(stmt, 13, max_device_number + 1), error_code, handle_error); -- 2.7.4