diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2008-02-14 22:34:10 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2008-02-14 22:34:10 +0000 |
commit | a8a8737dba1f46b93f4b9c3d1af07a4f910c9130 (patch) | |
tree | 9234363d1334080c59360f2e0f1eb22d0009bf99 /src/ne_gnutls.c | |
parent | aa17af89cd6d1b981b699354d88f43f0702e8b4c (diff) | |
download | neon-a8a8737dba1f46b93f4b9c3d1af07a4f910c9130.tar.gz |
* src/ne_gnutls.c (check_identity): Ensure that strings are NUL terminated
since this is not explicitly guaranteed by the GnuTLS API.
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1371 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'src/ne_gnutls.c')
-rw-r--r-- | src/ne_gnutls.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ne_gnutls.c b/src/ne_gnutls.c index 2629a99..8fd9325 100644 --- a/src/ne_gnutls.c +++ b/src/ne_gnutls.c @@ -362,11 +362,12 @@ static int check_identity(const ne_uri *server, gnutls_x509_crt cert, hostname = server ? server->host : ""; do { - len = sizeof name; + len = sizeof name - 1; ret = gnutls_x509_crt_get_subject_alt_name(cert, seq, name, &len, &critical); switch (ret) { case GNUTLS_SAN_DNSNAME: + name[len] = '\0'; if (identity && !found) *identity = ne_strdup(name); match = match_hostname(name, hostname); found = 1; @@ -396,6 +397,8 @@ static int check_identity(const ne_uri *server, gnutls_x509_crt cert, case GNUTLS_SAN_URI: { ne_uri uri; + name[len] = '\0'; + if (ne_uri_parse(name, &uri) == 0 && uri.host && uri.scheme) { ne_uri tmp; |