summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheoleun moon <chleun.moon@samsung.com>2022-07-25 14:53:13 +0900
committercheoleun moon <chleun.moon@samsung.com>2022-07-25 14:53:19 +0900
commitcc6562517020f61a2d2af59a18128d916591b4be (patch)
treed4f4b3ba05ce7b4b0a577cbe1822e2ab2942e5cb
parentb5a6b2366c6ba7db3ffa7f8f8b54e4e85d298e0d (diff)
downloadvine-tizen_7.0_hotfix.tar.gz
vine-tizen_7.0_hotfix.tar.bz2
vine-tizen_7.0_hotfix.zip
Change-Id: I3ce6df163b8cb66c4c1d0b8a11ead33c5a00e435
-rwxr-xr-xplugins/ble-gatt/ble-gatt-plugin.cpp2
-rwxr-xr-xplugins/dns-sd/dns-sd-plugin.cpp3
-rwxr-xr-xplugins/nan/nan-plugin.cpp1
-rwxr-xr-xsrc/vine-dp.cpp2
-rwxr-xr-xsrc/vine-service.cpp14
-rwxr-xr-xtests/vine-test/vine-ble-test.cpp20
6 files changed, 13 insertions, 29 deletions
diff --git a/plugins/ble-gatt/ble-gatt-plugin.cpp b/plugins/ble-gatt/ble-gatt-plugin.cpp
index 373f65d..cb02df9 100755
--- a/plugins/ble-gatt/ble-gatt-plugin.cpp
+++ b/plugins/ble-gatt/ble-gatt-plugin.cpp
@@ -261,7 +261,7 @@ static void __gatt_server_write_connection_value_requested_cb(const char *remote
vine_gatt_s *gatt = (vine_gatt_s *)user_data;
if (bt_gatt_server_send_response(request_id, BT_GATT_REQUEST_TYPE_WRITE,
- offset, BT_ERROR_NONE, "", 0) != BT_ERROR_NONE) {
+ offset, BT_ERROR_NONE, (char *)"", 0) != BT_ERROR_NONE) {
VINE_LOGE("Failed to send initiation message");
return;
}
diff --git a/plugins/dns-sd/dns-sd-plugin.cpp b/plugins/dns-sd/dns-sd-plugin.cpp
index 6f6bdc0..7f69ea2 100755
--- a/plugins/dns-sd/dns-sd-plugin.cpp
+++ b/plugins/dns-sd/dns-sd-plugin.cpp
@@ -75,7 +75,9 @@ static dns_sd_discovered_service_s *__create_discovered_service(
{
dns_sd_discovered_service_s *service = new dns_sd_discovered_service_s;
strncpy(service->service_type, service_type, VINE_MAX_SERVICE_TYPE_LEN);
+ service->service_type[VINE_MAX_SERVICE_TYPE_LEN] = '\0';
strncpy(service->service_name, service_name, VINE_MAX_SERVICE_NAME_LEN);
+ service->service_name[VINE_MAX_SERVICE_NAME_LEN] = '\0';
service->dns_sd_handle = dns_sd_handle;
return service;
}
@@ -582,6 +584,7 @@ vine_disc_error dns_sd_subscribe(void *plugin_handle,
const char *domain = NULL;
strncpy(dns_sd_handle->service_type, service_type, VINE_MAX_SERVICE_TYPE_LEN);
+ dns_sd_handle->service_type[VINE_MAX_SERVICE_TYPE_LEN] = '\0';
char stype[VINE_DNS_SD_SERVICE_TYPE_MAX_LEN + 1];
snprintf(stype, VINE_DNS_SD_SERVICE_TYPE_MAX_LEN,
VINE_DNS_SD_SERVICE_TYPE ",%s", service_type);
diff --git a/plugins/nan/nan-plugin.cpp b/plugins/nan/nan-plugin.cpp
index 8438d4e..8a1581f 100755
--- a/plugins/nan/nan-plugin.cpp
+++ b/plugins/nan/nan-plugin.cpp
@@ -45,7 +45,6 @@ typedef struct {
int port;
} vine_nan_s;
-static bool __is_nan_enabled = false;
static vine_disc_plugin_callbacks event_callbacks;
static vine_disc_error __convert_nan_error_to_vine_disc_error(int error)
diff --git a/src/vine-dp.cpp b/src/vine-dp.cpp
index 2a16363..dbbc195 100755
--- a/src/vine-dp.cpp
+++ b/src/vine-dp.cpp
@@ -1239,7 +1239,7 @@ int DPPubSub::publish_service()
// The length of value is at most (VINE_MAX_ATTRIBUTE_LEN(252) - key length(2) - 1 = 249)
// Therefore, at most five attributes can be added for a topic.
VINE_LOGD("Topic[%s] is added as attributes", mTopic.c_str());
- while (pos < mTopic.size()) {
+ while (pos < (int)mTopic.size()) {
std::string val = mTopic.substr(pos, VINE_MAX_ATTRIBUTE_LEN - 1 - 2);
char key[3];
key[0] = 'T';
diff --git a/src/vine-service.cpp b/src/vine-service.cpp
index d5b8258..52b8459 100755
--- a/src/vine-service.cpp
+++ b/src/vine-service.cpp
@@ -116,15 +116,15 @@ int _vine_service_clone(vine_service_h origin, vine_service_h *cloned)
vine_service_s *cloned_service = new vine_service_s;
cloned_service->type = origin_service->type;
- strncpy(cloned_service->service_type, origin_service->service_type, VINE_MAX_SERVICE_TYPE_LEN);
- strncpy(cloned_service->service_name, origin_service->service_name, VINE_MAX_SERVICE_NAME_LEN);
- strncpy(cloned_service->host_name, origin_service->host_name, VINE_MAX_HOST_NAME_LEN);
- strncpy(cloned_service->ip, origin_service->ip, VINE_MAX_IP_LEN);
+ memcpy(cloned_service->service_type, origin_service->service_type, VINE_MAX_SERVICE_TYPE_LEN + 1);
+ memcpy(cloned_service->service_name, origin_service->service_name, VINE_MAX_SERVICE_NAME_LEN + 1);
+ memcpy(cloned_service->host_name, origin_service->host_name, VINE_MAX_HOST_NAME_LEN + 1);
+ memcpy(cloned_service->ip, origin_service->ip, VINE_MAX_IP_LEN + 1);
cloned_service->family = origin_service->family;
cloned_service->port = origin_service->port;
cloned_service->attributes = origin_service->attributes;
- strncpy(cloned_service->iface_name, origin_service->iface_name, IF_NAMESIZE);
- strncpy(cloned_service->mac, origin_service->mac, VINE_MAC_LEN);
+ memcpy(cloned_service->iface_name, origin_service->iface_name, IF_NAMESIZE + 1);
+ memcpy(cloned_service->mac, origin_service->mac, VINE_MAC_LEN + 1);
cloned_service->state = origin_service->state;
cloned_service->disc_handle = NULL;
@@ -148,6 +148,7 @@ int _vine_service_set_type(
vine_service_s *s = (vine_service_s *)service;
strncpy(s->service_type, service_type, VINE_MAX_SERVICE_TYPE_LEN);
+ s->service_type[VINE_MAX_SERVICE_TYPE_LEN] = '\0';
return VINE_ERROR_NONE;
}
@@ -169,6 +170,7 @@ int _vine_service_set_name(
vine_service_s *s = (vine_service_s *)service;
strncpy(s->service_name, service_name, VINE_MAX_SERVICE_TYPE_LEN);
+ s->service_name[VINE_MAX_SERVICE_NAME_LEN] = '\0';
return VINE_ERROR_NONE;
}
diff --git a/tests/vine-test/vine-ble-test.cpp b/tests/vine-test/vine-ble-test.cpp
index 711bcac..f45325c 100755
--- a/tests/vine-test/vine-ble-test.cpp
+++ b/tests/vine-test/vine-ble-test.cpp
@@ -52,26 +52,6 @@ static vine_dp_h g_client_dp = NULL;
static std::list<vine_dp_h> g_datapath_list;
static std::list<vine_service_h> g_service_list;
-static bool test_get_user_string(const char *msg, char *buf, int buf_size)
-{
- if (msg == NULL || buf == NULL || buf_size < 2)
- return false;
-
- int ret;
- printf("%s", msg);
- fflush(stdout);
- memset(buf, 0, buf_size);
- ret = read(0, buf, buf_size - 1);
-
- if (ret < 0 || buf[0] == '\0' || buf[0] == '\n' || buf[0] == '\r') {
- buf[0] = '\0';
- return false;
- }
-
- buf[ret - 1] = '\0';
- return true;
-}
-
static void __quit()
{
PRINT_IF_ERROR(vine_deinitialize(), "vine_initialize()");