Description: fix DoS via missing header with AuthLDAPCharsetConfig
Origin: upstream, http://svn.apache.org/viewvc?view=revision&revision=1824456

Index: apache2-2.4.29/modules/aaa/mod_authnz_ldap.c
===================================================================
--- apache2-2.4.29.orig/modules/aaa/mod_authnz_ldap.c	2017-06-29 07:31:20.000000000 -0400
+++ apache2-2.4.29/modules/aaa/mod_authnz_ldap.c	2018-04-18 09:14:38.995193064 -0400
@@ -126,9 +126,13 @@ static char* derive_codepage_from_lang (
 
     charset = (char*) apr_hash_get(charset_conversions, language, APR_HASH_KEY_STRING);
 
-    if (!charset) {
-        language[2] = '\0';
-        charset = (char*) apr_hash_get(charset_conversions, language, APR_HASH_KEY_STRING);
+    /*
+     * Test if language values like 'en-US' return a match from the charset
+     * conversion map when shortened to 'en'.
+     */
+    if (!charset && strlen(language) > 3 && language[2] == '-') {
+        char *language_short = apr_pstrndup(p, language, 2);
+        charset = (char*) apr_hash_get(charset_conversions, language_short, APR_HASH_KEY_STRING);
     }
 
     if (charset) {
