board_identity:Fix potential buffer over flow

This commit is contained in:
David Sidrane 2017-09-07 13:26:55 -10:00 committed by Beat Küng
parent f24a052355
commit 1c2f8bd4c4
1 changed files with 1 additions and 1 deletions

View File

@ -118,7 +118,7 @@ int board_get_mfguid_formated(char *format_buffer, int size)
board_get_mfguid(mfguid);
int offset = 0;
for (unsigned i = 0; i < PX4_CPU_MFGUID_BYTE_LENGTH; i++) {
for (unsigned i = 0; offset < size && i < PX4_CPU_MFGUID_BYTE_LENGTH; i++) {
offset += snprintf(&format_buffer[offset], size - offset, "%02x", mfguid[i]);
}