зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1154235: Use |snprintf| in Bluetooth utililities, r=btian
The use of |sprintf| is unsafe and generally deprecated. This patch replaces |sprintf| in the Bluetooth utilities with |snprintf|.
This commit is contained in:
Родитель
f0aea25638
Коммит
ca73054656
|
@ -31,10 +31,11 @@ UuidToString(const BluetoothUuid& aUuid, nsAString& aString)
|
|||
memcpy(&uuid4, &aUuid.mUuid[10], sizeof(uint32_t));
|
||||
memcpy(&uuid5, &aUuid.mUuid[14], sizeof(uint16_t));
|
||||
|
||||
sprintf(uuidStr, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
|
||||
ntohl(uuid0), ntohs(uuid1),
|
||||
ntohs(uuid2), ntohs(uuid3),
|
||||
ntohl(uuid4), ntohs(uuid5));
|
||||
snprintf(uuidStr, sizeof(uuidStr),
|
||||
"%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
|
||||
ntohl(uuid0), ntohs(uuid1),
|
||||
ntohs(uuid2), ntohs(uuid3),
|
||||
ntohl(uuid4), ntohs(uuid5));
|
||||
|
||||
aString.Truncate();
|
||||
aString.AssignLiteral(uuidStr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче