sm7325-common: 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:
parent
e5deb4a931
commit
ae03a427fd
@ -485,11 +485,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;
|
||||
@ -534,11 +534,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user