Hello,

I have attached a very simple program which I believe displays a
serious problem in libidn. Even using IDNA_USE_STD3_ASCII_RULES it
still happily accepts almost anything.

Maybe I misunderstood and libidn is not designed for this kind of
thing. If so, could you suggest a better alternative?

With regards,
Martijn Otto

#include <idna.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    // input, output and result of the operation
    char *output;
    int  result;

    // try to convert the invalid domain name
    result = idna_to_unicode_8z8z(".org", &output, IDNA_USE_STD3_ASCII_RULES);

    // the .org domain is obviously bogus, so we expect an error
    if (result != IDNA_SUCCESS) return 0;

    // idna considered the bogus name valid, this is an error
    fprintf(stderr, "libidn considered our bogus domain name valid, and converted it to: '%s'\n", output);
    free(output);

    // something went wrong
    return 1;
}
_______________________________________________
Help-libidn mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-libidn

Reply via email to