sky: 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
This commit is contained in:
committed by
Lostark13
parent
6fce1687dc
commit
e1b6bfde41
@@ -495,11 +495,11 @@ void BtLeDeviceScanDetailsDataItem::stringify(string& valueStr) {
|
||||
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;
|
||||
@@ -544,11 +544,11 @@ void BtDeviceScanDetailsDataItem::stringify(string& valueStr) {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user