aboutsummaryrefslogtreecommitdiff
path: root/openssl/crypto/objects/obj_dat.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-09-02 18:48:52 +0200
committermarha <marha@users.sourceforge.net>2014-09-02 18:48:52 +0200
commitdea8f13d8104872dec9243abe06f3d9e4c807ccd (patch)
treeb01e5b901eaca45f1e3aa2b6fddfd45ca271ee75 /openssl/crypto/objects/obj_dat.c
parent3293021e6f582c7348667e7638941620134525e1 (diff)
parent04168ae281bfbd714ddf6b90d98eac892508dde8 (diff)
downloadvcxsrv-dea8f13d8104872dec9243abe06f3d9e4c807ccd.tar.gz
vcxsrv-dea8f13d8104872dec9243abe06f3d9e4c807ccd.tar.bz2
vcxsrv-dea8f13d8104872dec9243abe06f3d9e4c807ccd.zip
Merge remote-tracking branch 'origin/released'
Conflicts: openssl/Makefile openssl/crypto/opensslconf.h
Diffstat (limited to 'openssl/crypto/objects/obj_dat.c')
-rw-r--r--openssl/crypto/objects/obj_dat.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/openssl/crypto/objects/obj_dat.c b/openssl/crypto/objects/obj_dat.c
index 8a342ba3e..0b2f44241 100644
--- a/openssl/crypto/objects/obj_dat.c
+++ b/openssl/crypto/objects/obj_dat.c
@@ -471,11 +471,12 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
const unsigned char *p;
char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];
- if ((a == NULL) || (a->data == NULL)) {
- buf[0]='\0';
- return(0);
- }
+ /* Ensure that, at every state, |buf| is NUL-terminated. */
+ if (buf && buf_len > 0)
+ buf[0] = '\0';
+ if ((a == NULL) || (a->data == NULL))
+ return(0);
if (!no_name && (nid=OBJ_obj2nid(a)) != NID_undef)
{
@@ -554,9 +555,10 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
i=(int)(l/40);
l-=(long)(i*40);
}
- if (buf && (buf_len > 0))
+ if (buf && (buf_len > 1))
{
*buf++ = i + '0';
+ *buf = '\0';
buf_len--;
}
n++;
@@ -571,9 +573,10 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
i = strlen(bndec);
if (buf)
{
- if (buf_len > 0)
+ if (buf_len > 1)
{
*buf++ = '.';
+ *buf = '\0';
buf_len--;
}
BUF_strlcpy(buf,bndec,buf_len);
@@ -807,4 +810,3 @@ err:
OPENSSL_free(buf);
return(ok);
}
-