From: Lennart Poettering Date: Tue, 25 May 2021 21:40:01 +0000 (+0200) Subject: tpm2-util: accept empty string for empty PCR list X-Git-Tag: v249-rc1~150^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d57f6340b68aec2a3375c37a096c35967dc7f748;p=thirdparty%2Fsystemd.git tpm2-util: accept empty string for empty PCR list --- diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index 09f38ac867c..b2540c62fef 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -920,6 +920,13 @@ int tpm2_parse_pcrs(const char *s, uint32_t *ret) { uint32_t mask = 0; int r; + assert(s); + + if (isempty(s)) { + *ret = 0; + return 0; + } + /* Parses a "," or "+" separated list of PCR indexes. We support "," since this is a list after all, * and most other tools expect comma separated PCR specifications. We also support "+" since in * /etc/crypttab the "," is already used to separate options, hence a different separator is nice to