install IMC and IMV dynamic libraries in imcvs directory
[strongswan.git] / src / libimcv / plugins / imv_test / imv_test_state.c
index 36ccf4a..930da93 100644 (file)
@@ -109,6 +109,7 @@ METHOD(imv_state_t, get_reason_string, bool,
        chunk_t *reason_string, chunk_t *reason_language)
 {
        chunk_t pref_lang, lang;
+       u_char *pos;
        int i;
 
        while (eat_whitespace(&preferred_language))
@@ -119,6 +120,13 @@ METHOD(imv_state_t, get_reason_string, bool,
                        pref_lang = preferred_language;
                }
 
+               /* eat trailing whitespace */
+               pos = pref_lang.ptr + pref_lang.len - 1;
+               while (pref_lang.len && *pos-- == ' ')
+               {
+                       pref_lang.len--;
+               }
+
                for (i = 0 ; i < countof(reasons); i++)
                {
                        lang = chunk_create(reasons[i].lang, strlen(reasons[i].lang));