]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Make parsing APL strings more robust (not crashing if an ':' or '/' character is...
authorWillem Toorop <willem@NLnetLabs.nl>
Thu, 25 Aug 2011 11:02:12 +0000 (11:02 +0000)
committerWillem Toorop <willem@NLnetLabs.nl>
Thu, 25 Aug 2011 11:02:12 +0000 (11:02 +0000)
See bug #404

str2host.c

index 2eda2f805b64b47550eaef34460ce706e01c0860..4ec9d379bc7760272accf6c80f217b6c04cf6c28 100644 (file)
@@ -460,7 +460,10 @@ ldns_str2rdf_apl(ldns_rdf **rd, const char *str)
        size_t i = 0;
 
        /* [!]afi:address/prefix */
-       if (strlen(my_str) < 2) {
+       if (strlen(my_str) < 2
+                       || strchr(my_str, ':') == NULL
+                       || strchr(my_str, '/') == NULL
+                       || strchr(my_str, ':') > strchr(my_str, '/')) {
                return LDNS_STATUS_INVALID_STR;
        }