]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - lhnet.c
changed entity networking prioritization code to use the center of the model rather...
[xonotic/darkplaces.git] / lhnet.c
diff --git a/lhnet.c b/lhnet.c
index 4099ac6809e74a9690b91fd2fe268d687ecb3f2d..4f820099e2e6e2efe3e6707a359fa6ea064d9552 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -134,7 +134,9 @@ int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int def
                return 1;
        }
        // try to parse as dotted decimal ipv4 address first
-       if (sscanf(name, "%d.%d.%d.%d", &d1, &d2, &d3, &d4) == 4 && (unsigned int)d1 < 256 && (unsigned int)d2 < 256 && (unsigned int)d3 < 256 && (unsigned int)d4 < 256)
+       // note this supports partial ip addresses
+       d1 = d2 = d3 = d4 = 0;
+       if (sscanf(name, "%d.%d.%d.%d", &d1, &d2, &d3, &d4) >= 1 && (unsigned int)d1 < 256 && (unsigned int)d2 < 256 && (unsigned int)d3 < 256 && (unsigned int)d4 < 256)
        {
                // parsed a valid ipv4 address
                address->addresstype = LHNETADDRESSTYPE_INET4;