diff mbox series

[1/4] cert: Fix logic in cert_parse_asn1_time check

Message ID 20221031105342.2660357-1-andrew.zaborowski@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/4] cert: Fix logic in cert_parse_asn1_time check | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

Andrew Zaborowski Oct. 31, 2022, 10:53 a.m. UTC
Fix wrong operator in a condition that ended up being always true.
---
 ell/cert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ell/cert.c b/ell/cert.c
index b4f5df7..ab469c2 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -236,7 +236,7 @@  static uint64_t cert_parse_asn1_time(const uint8_t *data, size_t len,
 		return L_TIME_INVALID;
 
 	if (unlikely((len != i + 1 || data[i] != 'Z') &&
-			(len != i + 5 || data[i] != '+' || data[i] != '-')))
+			(len != i + 5 || (data[i] != '+' && data[i] != '-'))))
 		return L_TIME_INVALID;
 
 	tm.tm_year = (data[0] - '0') * 10 + (data[1] - '0');