diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-11-25 10:05:28 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-11-25 12:03:57 +0100 |
commit | 523e329db10e713e946171c7fae5aa3bb9b3e243 (patch) | |
tree | 948e41ae8562e15cca78e1e2f3b92528eca6b866 /lib/x509/common.c | |
parent | 70cd4bc9e78fed825a5b467ea4f760341de6ff10 (diff) | |
download | gnutls-tmp-idna-write.tar.gz |
Combined checks for printable characterstmp-idna-write
Diffstat (limited to 'lib/x509/common.c')
-rw-r--r-- | lib/x509/common.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c index d94761517a..c2585ee3fd 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2003-2014 Free Software Foundation, Inc. + * Copyright (C) 2015-2016 Red Hat, Inc. * * Author: Nikos Mavrogiannopoulos * @@ -32,7 +33,6 @@ #include "x509_int.h" #include "extras/hex.h" #include <common.h> -#include <c-ctype.h> static int data2hex(const void *data, size_t data_size, @@ -284,7 +284,6 @@ make_printable_string(unsigned etype, const gnutls_datum_t * input, { int printable = 0; int ret; - unsigned int i; if (etype == ASN1_ETYPE_BMP_STRING) { ret = _gnutls_ucs2_to_utf8(input->data, input->size, out, 1); @@ -294,15 +293,10 @@ make_printable_string(unsigned etype, const gnutls_datum_t * input, } else printable = 1; } else if (etype == ASN1_ETYPE_TELETEX_STRING) { - int ascii = 0; /* HACK: if the teletex string contains only ascii * characters then treat it as printable. */ - for (i = 0; i < input->size; i++) - if (!c_isprint(input->data[i])) - ascii = 1; - - if (ascii == 0) { + if (_gnutls_str_is_print((char*)input->data, input->size)) { out->data = gnutls_malloc(input->size + 1); if (out->data == NULL) return |