summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorguenther <>2014-04-16 17:46:23 +0000
committerguenther <>2014-04-16 17:46:23 +0000
commitcfac0f1df33b9dbd3cb6935b4fcc54f2ef14b7d5 (patch)
treee0268f2157c55f9da4289ce87c2de03333504dd4 /src
parentc1004dd77ba8447c75842b490d693604be9c79b9 (diff)
downloadopenbsd-cfac0f1df33b9dbd3cb6935b4fcc54f2ef14b7d5.tar.gz
openbsd-cfac0f1df33b9dbd3cb6935b4fcc54f2ef14b7d5.tar.bz2
openbsd-cfac0f1df33b9dbd3cb6935b4fcc54f2ef14b7d5.zip
Zero-pad usec format to handle values less than 100,000 correctly
ok matthew@ tedu@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_sign.c2
-rw-r--r--src/lib/libssl/src/crypto/ts/ts_rsp_sign.c2
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;