diff -up ypserv-2.19/rpc.yppasswdd/yppasswdd.c.ports ypserv-2.19/rpc.yppasswdd/yppasswdd.c --- ypserv-2.19/rpc.yppasswdd/yppasswdd.c.ports 2006-01-10 20:22:20.000000000 +0100 +++ ypserv-2.19/rpc.yppasswdd/yppasswdd.c 2008-09-25 13:11:23.000000000 +0200 @@ -333,6 +333,12 @@ main (int argc, char **argv) break; case '\253': my_port = atoi (optarg); + if (my_port <= 0 || my_port > 0xffff) { + /* Invalid port number */ + fprintf (stdout, "Warning: rpc.yppasswdd: Invalid port %d (0x%x)\n", + my_port, my_port); + my_port = -1; + } if (debug_flag) log_msg ("Using port %d\n", my_port); break; diff -up ypserv-2.19/rpc.ypxfrd/ypxfrd.c.ports ypserv-2.19/rpc.ypxfrd/ypxfrd.c --- ypserv-2.19/rpc.ypxfrd/ypxfrd.c.ports 2006-01-10 20:22:20.000000000 +0100 +++ ypserv-2.19/rpc.ypxfrd/ypxfrd.c 2008-09-25 13:11:23.000000000 +0200 @@ -199,6 +199,12 @@ main (int argc, char **argv) break; case 'p': my_port = atoi(optarg); + if (my_port <= 0 || my_port > 0xffff) { + /* Invalid port number */ + fprintf (stdout, "Warning: rpc.ypxfrd: Invalid port %d (0x%x)\n", + my_port, my_port); + my_port = -1; + } if (debug_flag) log_msg("Using port %d\n", my_port); break; diff -up ypserv-2.19/yppush/yppush.c.ports ypserv-2.19/yppush/yppush.c --- ypserv-2.19/yppush/yppush.c.ports 2005-05-31 11:14:40.000000000 +0200 +++ ypserv-2.19/yppush/yppush.c 2008-09-25 13:11:23.000000000 +0200 @@ -649,6 +649,12 @@ main (int argc, char **argv) log_msg ("yppush cannot run in parallel with a fixed port"); return 1; } + if (my_port <= 0 || my_port > 0xffff) { + /* Invalid port number */ + fprintf (stdout, "Warning: yppush: Invalid port %d (0x%x)\n", + my_port, my_port); + my_port = -1; + } break; default: Usage (1); diff -up ypserv-2.19/ypserv/ypserv.c.ports ypserv-2.19/ypserv/ypserv.c --- ypserv-2.19/ypserv/ypserv.c.ports 2008-09-25 13:11:23.000000000 +0200 +++ ypserv-2.19/ypserv/ypserv.c 2008-09-25 13:11:23.000000000 +0200 @@ -492,6 +492,12 @@ main (int argc, char **argv) break; case 'p': my_port = atoi (optarg); + if (my_port <= 0 || my_port > 0xffff) { + /* Invalid port number */ + fprintf (stdout, "Warning: ypserv: Invalid port %d (0x%x)\n", + my_port, my_port); + my_port = -1; + } if (debug_flag) log_msg ("Using port %d\n", my_port); break;