Skip to content

Commit 2f2e1bb

Browse files
committed
client: remove usage of unsafe sprintf function
1 parent a9bd4a5 commit 2f2e1bb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

main/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ app_main(void) {
345345
uint8_t mac[6];
346346
char mac_address[18];
347347
ESP_ERROR_CHECK(esp_base_mac_addr_get(mac));
348-
sprintf(mac_address, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
348+
snprintf(mac_address, sizeof(mac_address), "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
349349
ESP_LOGI(TAG, "MAC address of the device '%s'", mac_address);
350350

351351
/* Create mender-client event group */
@@ -360,7 +360,7 @@ app_main(void) {
360360

361361
/* Compute artifact name */
362362
char artifact_name[128];
363-
sprintf(artifact_name, "%s-v%s", running_app_info.project_name, running_app_info.version);
363+
snprintf(artifact_name, sizeof(artifact_name), "%s-v%s", running_app_info.project_name, running_app_info.version);
364364

365365
/* Retrieve device type */
366366
char *device_type = running_app_info.project_name;

0 commit comments

Comments
 (0)