From cfac0f1df33b9dbd3cb6935b4fcc54f2ef14b7d5 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Wed, 16 Apr 2014 17:46:23 +0000 Subject: Zero-pad usec format to handle values less than 100,000 correctly ok matthew@ tedu@ --- src/lib/libcrypto/ts/ts_rsp_sign.c | 2 +- src/lib/libssl/src/crypto/ts/ts_rsp_sign.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') 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, if the elements correspond to 0, they MUST be wholly omitted, and the decimal point element also MUST be omitted." */ - (void)snprintf(usecstr, sizeof(usecstr), ".%ld", usec); + (void)snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); /* truncate and trim trailing 0 */ usecstr[precision + 1] = '\0'; 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, if the elements correspond to 0, they MUST be wholly omitted, and the decimal point element also MUST be omitted." */ - (void)snprintf(usecstr, sizeof(usecstr), ".%ld", usec); + (void)snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); /* truncate and trim trailing 0 */ usecstr[precision + 1] = '\0'; p = usecstr + strlen(usecstr) - 1; -- cgit v1.2.3-55-g6feb