mercredi 20 février 2019

I need this to work without the library functions. Is there a way to reverse engineer what the function is doing?

//checks if ip address is valid format

bool is_ip(char * ip)
{

    int a = 0, b = 0, c = 0, d = 0;
    int con = sscanf_s(ip, "%d.%d.%d.%d", &a, &b, &c, &d);
    if (4 == con)
    {
        if ((0 <= a && a <= 255) && (0 <= b && b <= 255) && (0 <= c && c <= 255) && (0 <= d && d <= 255))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire