Skip to content

Commit

Permalink
Improvement: Don't use sprintf (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
zauguin committed Jan 7, 2021
1 parent e8c5cef commit 8f0ed0f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Marlin/src/registry/registry.cpp
Expand Up @@ -222,15 +222,17 @@ void Registry::ReportVersions(uint8_t * data) {
AppParmInfo * app_parm = (AppParmInfo *)FLASH_APP_PARA;

versions[index++] = CMD_S_VERSIONS_REACK;
const char *version;
if (data[0] == 0) {
versions[index++] = 0;
sprintf((char *)(versions + index), "%s", (char *)APP_VERSIONS);
index += strlen(APP_VERSIONS);
version = APP_VERSIONS;
} else {
versions[index++] = 1;
sprintf((char *)(versions + index), "%s", (char *)app_parm->versions);
index += strlen((char *)app_parm->versions);
version = reinterpret_cast<const char*>(app_parm->versions);
}
size_t length = strlen(version);
memcpy(versions + index, version, length);
index += length;
longpackInstance.sendLongpack(versions, index);
}

Expand Down

0 comments on commit 8f0ed0f

Please sign in to comment.