This appeared to be a copy-paste error from the "from" time case above.
Details
Details
- Reviewers
des bdrewery markj - Commits
- rG495850ff5ad3: ssh: correct parse_cert_times case for hex "to" time
rGa841c0c240b7: ssh: correct parse_cert_times case for hex "to" time
rG4718d86b3b1a: ssh: correct parse_cert_times case for hex "to" time
rG0657b2325df3: ssh: correct parse_cert_times case for hex "to" time
Reported by: Coverity Scan CID: 1500407 Sponsored by: The FreeBSD Foundation
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Coverity's report:
*** CID 1500407: Incorrect expression (COPY_PASTE_ERROR)
/crypto/openssh/ssh-keygen.c: 1978 in parse_cert_times()
1972 fatal("Invalid from time \"%s\"", from);
1973
1974 if (*to == '-' || *to == '+')
1975 cert_valid_to = parse_relative_time(to, now);
1976 else if (strcmp(to, "forever") == 0)
1977 cert_valid_to = ~(u_int64_t)0;
>>> CID 1500407: Incorrect expression (COPY_PASTE_ERROR)
>>> "from" in "strncmp(from, "0x", 2UL)" looks like a copy-paste error.
1978 else if (strncmp(from, "0x", 2) == 0)
1979 parse_hex_u64(to, &cert_valid_to);
1980 else if (parse_absolute_time(to, &cert_valid_to) != 0)
1981 fatal("Invalid to time \"%s\"", to);
1982
1983 if (cert_valid_to <= cert_valid_from)Comment Actions
For reference, issue was introduced in OpenSSH-portable ec1ddb72a146fd66d18df9cd423517453a5d8044, which references OpenBSD-Commit-ID: 454db1cdffa9fa346aea5211223a2ce0588dfe13