summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-12-07 23:58:44 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-12-07 23:58:44 +0000
commit1d4e879106676c68d6eb23319bfa412c5431ce53 (patch)
tree615ae042592e04aae478e3d1700caaf1e1c6d3a5 /crypto
parentae381fef5cdece911913ade392d844646f4db4b9 (diff)
Handle case where v6stat.zero_pos == 0 correctly.
Reported by: Kurt Roeckx <kurt@roeckx.be>, Tobias Ginzler <ginzler@fgan.de> (Debian bug #506111)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/x509v3/v3_utl.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c
index ba0a1c022d..1a866aaa83 100644
--- a/crypto/x509v3/v3_utl.c
+++ b/crypto/x509v3/v3_utl.c
@@ -739,17 +739,20 @@ static int ipv6_from_asc(unsigned char *v6, const char *in)
/* Format result */
- /* Copy initial part */
if (v6stat.zero_pos > 0)
+ {
+ /* Copy initial part */
memcpy(v6, v6stat.tmp, v6stat.zero_pos);
- /* Zero middle */
- if (v6stat.total != 16)
+ /* Zero middle */
memset(v6 + v6stat.zero_pos, 0, 16 - v6stat.total);
- /* Copy final part */
- if (v6stat.total != v6stat.zero_pos)
- memcpy(v6 + v6stat.zero_pos + 16 - v6stat.total,
- v6stat.tmp + v6stat.zero_pos,
- v6stat.total - v6stat.zero_pos);
+ /* Copy final part */
+ if (v6stat.total != v6stat.zero_pos)
+ memcpy(v6 + v6stat.zero_pos + 16 - v6stat.total,
+ v6stat.tmp + v6stat.zero_pos,
+ v6stat.total - v6stat.zero_pos);
+ }
+ else
+ memcpy(v6, v6stat.tmp, 16);
return 1;
}