Skip to content

Commit

Permalink
fix: error in version init
Browse files Browse the repository at this point in the history
  • Loading branch information
spikelin committed Jan 11, 2022
1 parent 2b68689 commit 0619e07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qcloud-iot-esp8266-demo/main/ota_esp/qcloud_iot_ota_esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ int enable_ota_task(DeviceInfo *dev_info, void *mqtt_client, char *version)
memset(&sg_ota_ctx, 0, sizeof(sg_ota_ctx));
return QCLOUD_ERR_FAILURE;
}
memset(sg_ota_ctx.local_version, 0, MAX_SIZE_OF_FW_VERSION + 4);
strncpy(sg_ota_ctx.local_version, version, strlen(version));
strncpy(sg_ota_ctx.local_version, version, MAX_SIZE_OF_FW_VERSION);
sg_ota_ctx.local_version[MAX_SIZE_OF_FW_VERSION - 1] = '\0';
#else
Log_w("OTA on ESP is not enabled!");
#endif
Expand Down

0 comments on commit 0619e07

Please sign in to comment.