diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-01-20 12:00:07 +0100 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-01-20 12:00:19 +0100 |
commit | 78424e4645f69d8ffe9421096630db6038980949 (patch) | |
tree | 3dfcfe9dcb39f694f158727782a1e4b92b845d13 /lib | |
parent | b527be10f829e286130705dfd14f8bb5661e7f35 (diff) | |
download | gnutls-78424e4645f69d8ffe9421096630db6038980949.tar.gz |
Avoid excessive CPU usage in gnutls_idna_map()tmp-fix-fuzzer-timeout
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/str-idna.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/str-idna.c b/lib/str-idna.c index 30a09407c0..4f275aebfb 100644 --- a/lib/str-idna.c +++ b/lib/str-idna.c @@ -81,6 +81,14 @@ int gnutls_idna_map(const char *input, unsigned ilen, gnutls_datum_t *out, unsig idn2_tflags |= IDN2_TRANSITIONAL; #endif + /* This avoids excessive CPU usage with libidn2 < 2.1.1 */ + if (ilen > 2048) { + gnutls_assert(); + _gnutls_debug_log("unable to convert name '%.*s' to IDNA format: %s\n", + (int) ilen, input, idn2_strerror(IDN2_TOO_BIG_DOMAIN)); + return GNUTLS_E_INVALID_UTF8_STRING; + } + if (ilen == 0) { out->data = (uint8_t*)gnutls_strdup(""); out->size = 0; |