summaryrefslogtreecommitdiff
path: root/src/shared/tpm2-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-05-25 23:40:01 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-25 23:40:01 +0200
commitd57f6340b68aec2a3375c37a096c35967dc7f748 (patch)
tree4f542abb8f8e34d7cd49fbe5df625c81e94741f0 /src/shared/tpm2-util.c
parenta1788a69b27b497ea75af2a97d7d7abde3e06eff (diff)
downloadsystemd-d57f6340b68aec2a3375c37a096c35967dc7f748.tar.gz
tpm2-util: accept empty string for empty PCR list
Diffstat (limited to 'src/shared/tpm2-util.c')
-rw-r--r--src/shared/tpm2-util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c
index 09f38ac867..b2540c62fe 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