DragonFlyBSD Kernel Audit
DF-1597 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/crypto/tpm/tpm.c b/sys/dev/crypto/tpm/tpm.c
--- a/sys/dev/crypto/tpm/tpm.c
+++ b/sys/dev/crypto/tpm/tpm.c
@@ -817,6 +817,8 @@
 	if ((rv = tpm_request_locality(sc, 0)) != 0)
 		return rv;
 
+	if (len <= 0)
+		return 0;
 	cnt = 0;
 	while (cnt < len - 1) {
 		for (r = tpm_getburst(sc); r > 0 && cnt < len - 1; r--) {