diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2006-02-15 16:04:42 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2006-02-15 16:04:42 +0100 |
commit | 9c339a722713740cc3de3c618398a477a0b56503 (patch) | |
tree | d74da6fc5696a613c7d192ddb7273b29db717ef2 /crypto/objects | |
parent | Fix warnings. (diff) | |
download | openssl-9c339a722713740cc3de3c618398a477a0b56503.tar.xz openssl-9c339a722713740cc3de3c618398a477a0b56503.zip |
Fix from stable branch.
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/obj_dat.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 9c61829c77..7a95c7795a 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -546,11 +546,19 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) buf_len--; } BUF_strlcpy(buf,bndec,buf_len); - buf += i; + if (i > buf_len) + { + buf += buf_len; + buf_len = 0; + } + else + { + buf+=i; + buf_len-=i; + } } n++; n += i; - buf_len -= i; OPENSSL_free(bndec); } else @@ -560,9 +568,17 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) if (buf && (buf_len > 0)) { BUF_strlcpy(buf,tbuf,buf_len); - buf+=i; + if (i > buf_len) + { + buf += buf_len; + buf_len = 0; + } + else + { + buf+=i; + buf_len-=i; + } } - buf_len-=i; n+=i; l=0; } |