tpm2: Check for n < 0 from asprintf before return

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2024-09-23 16:44:18 -04:00 committed by Stefan Berger
parent 27ceda7173
commit b97c3bb776
2 changed files with 4 additions and 0 deletions

View File

@ -721,6 +721,8 @@ skip:
n = asprintf(&nbuffer, "%s\"", buffer);
free(buffer);
if (n < 0)
return NULL;
return nbuffer;
}

View File

@ -233,6 +233,8 @@ RuntimeAttributesGet(struct RuntimeAttributes *RuntimeAttributes,
n = asprintf(&nbuffer, "%s\"", buffer);
free(buffer);
if (n < 0)
return NULL;
return nbuffer;
}