From: Ivailo Monev Date: Tue, 1 Nov 2022 07:39:49 +0000 (+0200) Subject: correct the buffer size in qRandomUuid() function X-Git-Tag: 4.12.0~253 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=57f3e74d1da2884fdf11a5b266f1643ba348839d;p=kde%2FKatie.git correct the buffer size in qRandomUuid() function the initial implementation was not passing the buffer size to the QByteArray constructor so the additional bit was for qstrlen() Signed-off-by: Ivailo Monev --- diff --git a/src/core/tools/qbytearray.cpp b/src/core/tools/qbytearray.cpp index e1d374a53..a6cc25073 100644 --- a/src/core/tools/qbytearray.cpp +++ b/src/core/tools/qbytearray.cpp @@ -263,7 +263,7 @@ QByteArray qRandomUuid() uuidbuf[bufi + 1] = tohex[randombuf[randi] & 0xf]; static const char tohex[] = "0123456789abcdef"; - QSTACKARRAY(char, uuidbuf, 37); + QSTACKARRAY(char, uuidbuf, 36); UUID_TOHEX(0, 0); UUID_TOHEX(2, 1); UUID_TOHEX(4, 2); @@ -1195,7 +1195,7 @@ QByteArray::QByteArray(int size, char ch) if (size <= 0) { d = &shared_null; } else { - d = static_cast(::malloc(sizeof(Data)+size)); + d = static_cast(::malloc(sizeof(Data) + size)); Q_CHECK_PTR(d); d->ref = 0; d->alloc = d->size = size;