Fix from stable branch.

This commit is contained in:
Dr. Stephen Henson 2006-02-15 15:04:42 +00:00
parent e7a8b47f1a
commit 9c339a7227

View File

@ -546,11 +546,19 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
buf_len--; buf_len--;
} }
BUF_strlcpy(buf,bndec,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++;
n += i; n += i;
buf_len -= i;
OPENSSL_free(bndec); OPENSSL_free(bndec);
} }
else 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)) if (buf && (buf_len > 0))
{ {
BUF_strlcpy(buf,tbuf,buf_len); 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; n+=i;
l=0; l=0;
} }