From 60052bd85f2d91293457e8811b0cf26b773de469 Mon Sep 17 00:00:00 2001 From: Taru Karttunen Date: Sun, 21 Jun 2015 14:05:05 +0300 Subject: [PATCH] ssh: Add explicit type in comparison with constant to make go-fuzz happy Currently using go-fuzz with code using golang.org/x/crypto/ssh fails because it passes CertTimeInfinity to an interface{} and automatically tries to use an int, which overflows and results in a compile error. This change adds a no-op type conversion inside the function which makes things compile with go-fuzz. Change-Id: Iade0c0df7e20cbac4928480fad3e44c831e1e00a Reviewed-on: https://go-review.googlesource.com/11285 Reviewed-by: Adam Langley --- ssh/certs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/certs.go b/ssh/certs.go index a7426b6..3857700 100644 --- a/ssh/certs.go +++ b/ssh/certs.go @@ -368,7 +368,7 @@ func (c *CertChecker) CheckCert(principal string, cert *Certificate) error { if after := int64(cert.ValidAfter); after < 0 || unixNow < int64(cert.ValidAfter) { return fmt.Errorf("ssh: cert is not yet valid") } - if before := int64(cert.ValidBefore); cert.ValidBefore != CertTimeInfinity && (unixNow >= before || before < 0) { + if before := int64(cert.ValidBefore); cert.ValidBefore != uint64(CertTimeInfinity) && (unixNow >= before || before < 0) { return fmt.Errorf("ssh: cert has expired") } if err := cert.SignatureKey.Verify(cert.bytesForSigning(), cert.Signature); err != nil {