chiark / gitweb /
Do not use ports >512 even if configured. (rshd)
[authbind.git] / helper.c
index 5bd95fd24dbc8ed66d6826508cf02ed4f9f45a3d..96892abf476fb4e6dc1925f3d4f518fd1d7c9812 100644 (file)
--- a/helper.c
+++ b/helper.c
@@ -72,6 +72,7 @@ int main(int argc, const char *const *argv) {
   if (argc != 3) badusage(); 
   addr= strtoul(argv[1],&ep,16); if (*ep || addr&~0x0ffffffffUL) badusage();
   port= strtoul(argv[2],&ep,16); if (*ep || port&~0x0ffffUL) badusage();
+  if (port >= IPPORT_RESERVED/2) _exit(EPERM);
 
   if (chdir(CONFIGDIR)) perrorfail("chdir " CONFIGDIR);