Skip to content

Commit

Permalink
Merge pull request Samsung#3282 from Hyunjun85/imp
Browse files Browse the repository at this point in the history
framework/st_things: fix logical error.
  • Loading branch information
SeonghoByeon authored Jun 10, 2019
2 parents e5d026e + fff2b67 commit a1142ab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
2 changes: 2 additions & 0 deletions framework/src/st_things/things_stack/easy-setup/easysetup.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ bool es_get_cloud_login_state(void)
case ES_STATE_PUBLISHED_RESOURCES_TO_CLOUD:
case ES_STATE_FAILED_TO_PUBLISH_RESOURCES_TO_CLOUD:
res = true;
break;
default:
res = false;
break;
}

return res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1160,12 +1160,12 @@ static int parse_configuration_json(cJSON *configuration)
}
memcpy(g_things_cloud_file_path, provisioning->valuestring, strlen(provisioning->valuestring));
} else {
if (strlen(provisioning->valuestring) > (size_t)MAX_CLOUD_ADDRESS - strlen(PATH_MNT)) {
if (strlen(provisioning->valuestring) > (size_t)MAX_FILE_PATH_LENGTH - strlen(PATH_MNT)) {
THINGS_LOG_V(TAG, "provisioning file path length exceeded");
goto JSON_ERROR;
}
strncpy(g_things_cloud_file_path, PATH_MNT, strlen(PATH_MNT));
strncat(g_things_cloud_file_path, provisioning->valuestring, (size_t)MAX_CLOUD_ADDRESS - strlen(PATH_MNT));
strncat(g_things_cloud_file_path, provisioning->valuestring, (size_t)MAX_FILE_PATH_LENGTH - strlen(PATH_MNT));
}

#ifndef CONFIG_ST_THINGS_HW_CERT_KEY
Expand Down Expand Up @@ -1296,10 +1296,12 @@ static int parse_resource_type_json_with_internal(cJSON *resource_types_user)
memcpy(restype->prop[iter2]->key, key->valuestring, strlen(key->valuestring) + 1);
}
restype->prop[iter2]->type = type->valueint;
if (mandatory->type == cJSON_True) {
restype->prop[iter2]->mandatory = true;
} else {
restype->prop[iter2]->mandatory = false;
if (mandatory != NULL) {
if (mandatory->type == cJSON_True) {
restype->prop[iter2]->mandatory = true;
} else {
restype->prop[iter2]->mandatory = false;
}
}
if (rw != NULL) {
restype->prop[iter2]->rw = rw->valueint;
Expand Down
2 changes: 2 additions & 0 deletions framework/src/st_things/things_stack/things_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,9 @@ int things_return_user_opinion_for_reset(int reset)
things_set_reset_mask(RST_USER_CONFIRM_COMPLETED);
result = 1;
} else { // User not allow Reset.
pthread_mutex_lock(&m_thread_oic_reset);
b_reset_continue_flag = false;
pthread_mutex_unlock(&m_thread_oic_reset);
}

THINGS_LOG_D(TAG, "User Opinion : %d", result);
Expand Down
11 changes: 8 additions & 3 deletions framework/src/st_things/things_stack/utils/things_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ int things_get_ap_list(access_point_info_s** p_info, int* p_count)
access_point_info_s *pinfo = NULL;
access_point_info_s *p_last_info = NULL;
while (wifi_scan_iter != NULL) {
if (wifi_scan_iter->e_ssid != NULL) {
if (wifi_scan_iter->e_ssid[0] != NULL) {
pinfo = (access_point_info_s*)things_malloc(sizeof(access_point_info_s));
if (pinfo != NULL) {
pinfo->next = NULL;
Expand All @@ -260,7 +260,9 @@ int things_get_ap_list(access_point_info_s** p_info, int* p_count)
if (*p_info == NULL) {
*p_info = pinfo;
} else {
p_last_info->next = pinfo;
if (p_last_info != NULL) {
p_last_info->next = pinfo;
}
}
p_last_info = pinfo;
}
Expand Down Expand Up @@ -384,8 +386,11 @@ void things_wifi_scan_done(wifi_manager_scan_info_s **scan_result, wifi_manager_
access_point_info_s *pinfo = NULL;
access_point_info_s *p_last_info = NULL;
while (wifi_scan_iter != NULL) {
if ((wifi_scan_iter->ssid != NULL) && (strlen(wifi_scan_iter->ssid)) != 0) {
if ((wifi_scan_iter->ssid[0] != NULL) && (strlen(wifi_scan_iter->ssid)) != 0) {
pinfo = (access_point_info_s*)things_malloc(sizeof(access_point_info_s));
if (pinfo == NULL) {
break;
}
pinfo->next = NULL;
snprintf(pinfo->e_ssid, WIFIMGR_SSID_LEN, "%s", wifi_scan_iter->ssid);
snprintf(pinfo->bss_id, WIFIMGR_MACADDR_STR_LEN, "%s", wifi_scan_iter->bssid);
Expand Down

0 comments on commit a1142ab

Please sign in to comment.