diff --git a/src/rx/rx_identity.c b/src/rx/rx_identity.c index ae9c694d19..3d87ec4364 100644 --- a/src/rx/rx_identity.c +++ b/src/rx/rx_identity.c @@ -79,8 +79,11 @@ rx_identity_populate(struct rx_identity *identity, rx_identity_kind kind, memset(identity, 0, sizeof(struct rx_identity)); identity->kind = kind; - identity->displayName = rxi_Alloc(strlen(displayName)+1); - memcpy(identity->displayName, displayName, strlen(displayName)+1); + + if (displayName) { + identity->displayName = rxi_Alloc(strlen(displayName)+1); + memcpy(identity->displayName, displayName, strlen(displayName)+1); + } rx_opaque_populate(&identity->exportedName, enameData, enameLength); } diff --git a/src/rx/rx_opaque.c b/src/rx/rx_opaque.c index db3e407063..0b3ee2dd34 100644 --- a/src/rx/rx_opaque.c +++ b/src/rx/rx_opaque.c @@ -110,6 +110,9 @@ rx_opaque_populate(struct rx_opaque *to, void *data, size_t datalen) to->len = 0; to->val = NULL; + if (data == NULL || datalen == 0) + return 0; + code = rx_opaque_alloc(to, datalen); if (code) return code;