Commit 0d3fa993 authored by Ondřej Surý's avatar Ondřej Surý
Browse files

lib/isc/pkc11.c: Fix possible NULL pointer dereference in push_attribute()

(cherry picked from commit e8948fd9)
parent 75111d4a
......@@ -1131,13 +1131,17 @@ push_attribute(pk11_object_t *obj, isc_mem_t *mctx, size_t len) {
CK_ATTRIBUTE *attr;
CK_BYTE cnt = obj->attrcnt;
REQUIRE(old != NULL || cnt == 0);
obj->repr = isc_mem_get(mctx, (cnt + 1) * sizeof(*attr));
if (obj->repr == NULL) {
obj->repr = old;
return (NULL);
}
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->ulValueLen = (CK_ULONG) len;
attr->pValue = isc_mem_get(mctx, len);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment