diff options
| author | guenther <> | 2014-04-16 17:46:23 +0000 |
|---|---|---|
| committer | guenther <> | 2014-04-16 17:46:23 +0000 |
| commit | 898b424c69eec8bff47c09751962ca33d0c4231b (patch) | |
| tree | e0268f2157c55f9da4289ce87c2de03333504dd4 | |
| parent | b874b7b6bf7030d9fe970665ac5c21a389b6a9a3 (diff) | |
| download | openbsd-898b424c69eec8bff47c09751962ca33d0c4231b.tar.gz openbsd-898b424c69eec8bff47c09751962ca33d0c4231b.tar.bz2 openbsd-898b424c69eec8bff47c09751962ca33d0c4231b.zip | |
Zero-pad usec format to handle values less than 100,000 correctly
ok matthew@ tedu@
| -rw-r--r-- | src/lib/libcrypto/ts/ts_rsp_sign.c | 2 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/ts/ts_rsp_sign.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ts/ts_rsp_sign.c b/src/lib/libcrypto/ts/ts_rsp_sign.c index 235c0a8476..e7186a8ce0 100644 --- a/src/lib/libcrypto/ts/ts_rsp_sign.c +++ b/src/lib/libcrypto/ts/ts_rsp_sign.c | |||
| @@ -983,7 +983,7 @@ TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time, | |||
| 983 | if the elements correspond to 0, they MUST be wholly | 983 | if the elements correspond to 0, they MUST be wholly |
| 984 | omitted, and the decimal point element also MUST be | 984 | omitted, and the decimal point element also MUST be |
| 985 | omitted." */ | 985 | omitted." */ |
| 986 | (void)snprintf(usecstr, sizeof(usecstr), ".%ld", usec); | 986 | (void)snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); |
| 987 | /* truncate and trim trailing 0 */ | 987 | /* truncate and trim trailing 0 */ |
| 988 | usecstr[precision + 1] = '\0'; | 988 | usecstr[precision + 1] = '\0'; |
| 989 | p = usecstr + strlen(usecstr) - 1; | 989 | p = usecstr + strlen(usecstr) - 1; |
diff --git a/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c b/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c index 235c0a8476..e7186a8ce0 100644 --- a/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c +++ b/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c | |||
| @@ -983,7 +983,7 @@ TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time, | |||
| 983 | if the elements correspond to 0, they MUST be wholly | 983 | if the elements correspond to 0, they MUST be wholly |
| 984 | omitted, and the decimal point element also MUST be | 984 | omitted, and the decimal point element also MUST be |
| 985 | omitted." */ | 985 | omitted." */ |
| 986 | (void)snprintf(usecstr, sizeof(usecstr), ".%ld", usec); | 986 | (void)snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); |
| 987 | /* truncate and trim trailing 0 */ | 987 | /* truncate and trim trailing 0 */ |
| 988 | usecstr[precision + 1] = '\0'; | 988 | usecstr[precision + 1] = '\0'; |
| 989 | p = usecstr + strlen(usecstr) - 1; | 989 | p = usecstr + strlen(usecstr) - 1; |
