From 1c2f8bd4c4056f69e6e9dc7829e451d16b4c7adc Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Thu, 7 Sep 2017 13:26:55 -1000 Subject: [PATCH] board_identity:Fix potential buffer over flow --- src/drivers/boards/common/stm32/board_identity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/boards/common/stm32/board_identity.c b/src/drivers/boards/common/stm32/board_identity.c index 41e52a186c..4a5f66c589 100644 --- a/src/drivers/boards/common/stm32/board_identity.c +++ b/src/drivers/boards/common/stm32/board_identity.c @@ -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]); }