mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
lib/isc/pkc11.c: Fix possible NULL pointer dereference in push_attribute()
This commit is contained in:
@@ -800,9 +800,13 @@ push_attribute(pk11_object_t *obj, isc_mem_t *mctx, size_t len) {
|
|||||||
CK_ATTRIBUTE *attr;
|
CK_ATTRIBUTE *attr;
|
||||||
CK_BYTE cnt = obj->attrcnt;
|
CK_BYTE cnt = obj->attrcnt;
|
||||||
|
|
||||||
|
REQUIRE(old != NULL || cnt == 0);
|
||||||
|
|
||||||
obj->repr = isc_mem_get(mctx, (cnt + 1) * sizeof(*attr));
|
obj->repr = isc_mem_get(mctx, (cnt + 1) * sizeof(*attr));
|
||||||
memset(obj->repr, 0, (cnt + 1) * sizeof(*attr));
|
memset(obj->repr, 0, (cnt + 1) * sizeof(*attr));
|
||||||
memmove(obj->repr, old, cnt * sizeof(*attr));
|
if (old != NULL) {
|
||||||
|
memmove(obj->repr, old, cnt * sizeof(*attr));
|
||||||
|
}
|
||||||
attr = obj->repr + cnt;
|
attr = obj->repr + cnt;
|
||||||
attr->ulValueLen = (CK_ULONG) len;
|
attr->ulValueLen = (CK_ULONG) len;
|
||||||
attr->pValue = isc_mem_get(mctx, len);
|
attr->pValue = isc_mem_get(mctx, len);
|
||||||
|
Reference in New Issue
Block a user