Fix a segfault with an unknown interface
authorVolker Lendecke <vl@sernet.de>
Sat, 13 Oct 2007 14:27:52 +0000 (16:27 +0200)
committerVolker Lendecke <vl@sernet.de>
Sat, 13 Oct 2007 19:44:58 +0000 (21:44 +0200)
"interfaces = foo" with "foo" not being a known interface segfaulted for me.
(This used to be commit 556c33702ce6d6c7cde43ddfe965c78ebc2963d3)

source3/lib/interface.c

index 1471a06f46cf0c5db3f01ee2163dfa34f7223fcc..2eaadab0ecada076fcb93132d8f54dfdfa17d8b7 100644 (file)
@@ -460,7 +460,13 @@ static void interpret_interface(char *token)
 
        /* maybe it is a DNS name */
        p = strchr_m(token,'/');
-       if (!p && interpret_string_addr(&ss, token)) {
+       if (p == NULL) {
+               if (!interpret_string_addr(&ss, token)) {
+                       DEBUG(2, ("interpret_interface: Can't find address "
+                                 "for %s\n", token));
+                       return;
+               }
+
                for (i=0;i<total_probed;i++) {
                        if (addr_equal(&ss, &probed_ifaces[i].ip)) {
                                add_interface(&probed_ifaces[i]);