+2008-05-29 Martin Nagy <mnagy@redhat.com>
+
+ * */*main.c: Sanity check port numbers before using.
+
2008-01-30 Peter Szilagyi <sp615@hszk.bme.hu>
* lib/stream.h: Remove named 'new' parameter in prototype
int dryrun = 0;
char *progname;
struct thread thread;
+ int tmp_port;
/* Set umask before anything for security */
umask (0027);
pid_file = optarg;
break;
case 'p':
- bm->port = atoi (optarg);
+ tmp_port = atoi (optarg);
+ if (tmp_port <= 0 || tmp_port > 0xffff)
+ bm->port = BGP_PORT_DEFAULT;
+ else
+ bm->port = tmp_port;
break;
case 'A':
vty_addr = optarg;
break;
}
vty_port = atoi (optarg);
- vty_port = (vty_port ? vty_port : BGP_VTY_PORT);
+ if (vty_port <= 0 || vty_port > 0xffff)
+ vty_port = BGP_VTY_PORT;
break;
case 'r':
retain_mode = 1;
break;
}
vty_port = atoi (optarg);
- vty_port = (vty_port ? vty_port : OSPF6_VTY_PORT);
+ if (vty_port <= 0 || vty_port > 0xffff)
+ vty_port = OSPF6_VTY_PORT;
break;
case 'u':
ospf6d_privs.user = optarg;
break;
}
vty_port = atoi (optarg);
- vty_port = (vty_port ? vty_port : OSPF_VTY_PORT);
+ if (vty_port <= 0 || vty_port > 0xffff)
+ vty_port = OSPF_VTY_PORT;
break;
case 'u':
ospfd_privs.user = optarg;
break;
}
vty_port = atoi (optarg);
- vty_port = (vty_port ? vty_port : RIP_VTY_PORT);
+ if (vty_port <= 0 || vty_port > 0xffff)
+ vty_port = RIP_VTY_PORT;
break;
case 'r':
retain_mode = 1;
break;
}
vty_port = atoi (optarg);
- vty_port = (vty_port ? vty_port : RIPNG_VTY_PORT);
+ if (vty_port <= 0 || vty_port > 0xffff)
+ vty_port = RIPNG_VTY_PORT;
break;
case 'r':
retain_mode = 1;
break;
}
vty_port = atoi (optarg);
- vty_port = (vty_port ? vty_port : ZEBRA_VTY_PORT);
+ if (vty_port <= 0 || vty_port > 0xffff)
+ vty_port = ZEBRA_VTY_PORT;
break;
case 'r':
retain_mode = 1;