FP5: gps: data-items: Fix snprintf usage
Fixes:
gps/core/data-items/DataItemConcreteTypes.cpp:465:9: error: 'snprintf'
will always be truncated; specified size is 10, but format string
expands to at least 20 [-Werror,-Wfortify-source]
465 | snprintf(t, sizeof(t),
"[%02x:%02x:%02x:%02x:%02x:%02x]", d->mApSrnMacAddress[0],
| ^
gps/core/data-items/DataItemConcreteTypes.cpp:514:9: error: 'snprintf'
will always be truncated; specified size is 10, but format string
expands to at least 20 [-Werror,-Wfortify-source]
514 | snprintf(t, sizeof(t),
"[%02x:%02x:%02x:%02x:%02x:%02x]", d->mApSrnMacAddress[0],
| ^
2 errors generated.
Change-Id: I37188e7497f7ade97648fb41e2becd73f6b559a9
diff --git a/gps/core/data-items/DataItemConcreteTypes.cpp b/gps/core/data-items/DataItemConcreteTypes.cpp
index 56ef96f..6267366 100644
--- a/gps/core/data-items/DataItemConcreteTypes.cpp
+++ b/gps/core/data-items/DataItemConcreteTypes.cpp
@@ -482,11 +482,11 @@
valueStr += d->mApSrnRssi;
valueStr += ", ";
- char t[10];
- memset (t, '\0', 10);
+ char t[20];
+ memset (t, '\0', 20);
valueStr += BTLESCANDETAILS_FIELD_MAC;
valueStr += ": ";
- snprintf(t, 10, "[%02x:%02x:%02x:%02x:%02x:%02x]", d->mApSrnMacAddress[0],
+ snprintf(t, 20, "[%02x:%02x:%02x:%02x:%02x:%02x]", d->mApSrnMacAddress[0],
d->mApSrnMacAddress[1], d->mApSrnMacAddress[2], d->mApSrnMacAddress[3],
d->mApSrnMacAddress[4], d->mApSrnMacAddress[5]);
valueStr += t;
@@ -531,11 +531,11 @@
valueStr += d->mApSrnRssi;
valueStr += ", ";
- char t[10];
- memset (t, '\0', 10);
+ char t[20];
+ memset (t, '\0', 20);
valueStr += BTSCANDETAILS_FIELD_MAC;
valueStr += ": ";
- snprintf(t, 10, "[%02x:%02x:%02x:%02x:%02x:%02x]", d->mApSrnMacAddress[0],
+ snprintf(t, 20, "[%02x:%02x:%02x:%02x:%02x:%02x]", d->mApSrnMacAddress[0],
d->mApSrnMacAddress[1], d->mApSrnMacAddress[2], d->mApSrnMacAddress[3],
d->mApSrnMacAddress[4], d->mApSrnMacAddress[5]);
valueStr += t;