summaryrefslogtreecommitdiff
path: root/lib/x509asn1.c
diff options
context:
space:
mode:
authorseonah moon <seonah1.moon@samsung.com>2016-04-06 19:31:17 -0700
committerseonah moon <seonah1.moon@samsung.com>2016-04-06 19:31:17 -0700
commitf7bbc1c9b6a8e2c815d09612b53f453c90d962e0 (patch)
tree10a20bd420864ba529d87794b27ebf303ae7c86a /lib/x509asn1.c
parent31368b6eac8092a307849518e912b4c475c0238a (diff)
downloadcurl-f7bbc1c9b6a8e2c815d09612b53f453c90d962e0.tar.gz
curl-f7bbc1c9b6a8e2c815d09612b53f453c90d962e0.tar.bz2
curl-f7bbc1c9b6a8e2c815d09612b53f453c90d962e0.zip
Revert "Imported Upstream version 7.44.0"
This reverts commit 31368b6eac8092a307849518e912b4c475c0238a. Change-Id: I3428294b4931a00ba9684528d3ffb326f92ed4e8
Diffstat (limited to 'lib/x509asn1.c')
-rw-r--r--lib/x509asn1.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/x509asn1.c b/lib/x509asn1.c
index a3dfd646b..af08cee54 100644
--- a/lib/x509asn1.c
+++ b/lib/x509asn1.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -22,8 +22,7 @@
#include "curl_setup.h"
-#if defined(USE_GSKIT) || defined(USE_NSS) || defined(USE_GNUTLS) || \
- defined(USE_CYASSL)
+#if defined(USE_GSKIT) || defined(USE_NSS)
#include <curl/curl.h>
#include "urldata.h"
@@ -34,7 +33,10 @@
#include "inet_pton.h"
#include "curl_base64.h"
#include "x509asn1.h"
-#include "curl_printf.h"
+
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
@@ -210,6 +212,7 @@ static const char * octet2str(const char * beg, const char * end)
}
static const char * bit2str(const char * beg, const char * end)
+
{
/* Convert an ASN.1 bit string to a printable string.
Return the dynamically allocated string, or NULL if an error occurs. */
@@ -298,10 +301,8 @@ utf8asn1str(char * * to, int type, const char * from, const char * end)
case 4:
wc = (wc << 8) | *(const unsigned char *) from++;
wc = (wc << 8) | *(const unsigned char *) from++;
- /* fallthrough */
case 2:
wc = (wc << 8) | *(const unsigned char *) from++;
- /* fallthrough */
default: /* case 1: */
wc = (wc << 8) | *(const unsigned char *) from++;
}
@@ -539,6 +540,8 @@ static const char * UTime2str(const char * beg, const char * end)
const char * Curl_ASN1tostr(curl_asn1Element * elem, int type)
{
+ static const char zero = '\0';
+
/* Convert an ASN.1 element to a printable string.
Return the dynamically allocated string, or NULL if an error occurs. */
@@ -559,7 +562,7 @@ const char * Curl_ASN1tostr(curl_asn1Element * elem, int type)
case CURL_ASN1_OCTET_STRING:
return octet2str(elem->beg, elem->end);
case CURL_ASN1_NULL:
- return strdup("");
+ return strdup(&zero);
case CURL_ASN1_OBJECT_IDENTIFIER:
return OID2str(elem->beg, elem->end, TRUE);
case CURL_ASN1_UTC_TIME:
@@ -821,7 +824,7 @@ static void do_pubkey(struct SessionHandle * data, int certnum,
/* Compute key length. */
for(q = elem.beg; !*q && q < elem.end; q++)
;
- len = (unsigned long)((elem.end - q) * 8);
+ len = (elem.end - q) * 8;
if(len)
for(i = *(unsigned char *) q; !(i & 0x80); i <<= 1)
len--;
@@ -1024,7 +1027,7 @@ CURLcode Curl_extract_certinfo(struct connectdata * conn,
return CURLE_OK;
}
-#endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_CYASSL */
+#endif /* USE_GSKIT or USE_NSS */
#if defined(USE_GSKIT)
@@ -1116,7 +1119,8 @@ CURLcode Curl_verifyhost(struct connectdata * conn,
if(len > 0)
if(strlen(dnsname) == (size_t) len)
i = Curl_cert_hostcheck((const char *) dnsname, conn->host.name);
- free(dnsname);
+ if(dnsname)
+ free(dnsname);
if(!i)
return CURLE_PEER_FAILED_VERIFICATION;
matched = i;