Skip to content

Commit 879be41

Browse files
William Robertswhooo
authored andcommitted
policy: fix hardcoded size in description
Fixes: #546 Signed-off-by: William Roberts <[email protected]>
1 parent b56e9ec commit 879be41

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/tpm2_pytss/policy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,16 @@ def get_calculated_json(self) -> bytes:
570570

571571
cjson = ffi.new("uint8_t[]", size[0])
572572
_chkrc(lib.Tss2_PolicyGetCalculatedJSON(self._ctx, cjson, size))
573+
573574
return ffi.string(cjson, size[0])
574575

575576
@property
576577
def description(self) -> bytes:
577578
"""bytes: The policy description."""
578-
size = ffi.new("size_t *", 8096)
579-
desc = ffi.new("uint8_t[]", 8096)
579+
size = ffi.new("size_t *")
580+
_chkrc(lib.Tss2_PolicyGetDescription(self._ctx, ffi.NULL, size))
581+
582+
desc = ffi.new("uint8_t[]", size[0])
580583
_chkrc(lib.Tss2_PolicyGetDescription(self._ctx, desc, size))
581584
return ffi.string(desc, size[0])
582585

0 commit comments

Comments
 (0)