Kris Katterjohn [katterj...@gmail.com] wrote:
> Hello,
> 
> I think I've found an off-by-one bug in httpd: it cannot listen on port
> 65535 when the port is specified as a number (although it can listen on
> it if specified as the string "65535", or if an appropriate line is
> added to /etc/services and it's specified with that name).
> 
> $ uname -a
> OpenBSD Meryl 6.1 GENERIC.MP#19 amd64
> 
> $ cat /etc/httpd.conf
> server "default" {
>   listen on egress port 65535
> }
> 
> $ doas httpd -n
> /etc/httpd.conf:2: invalid port: 65535
> no actions, nothing to do
> 
> 
> The above is on 6.1, but it looks like the problem still exists in CVS.
> 
> Below is a patch (or the possible start of one).  It's untested as I
> cannot do a build and test it right now, but I think it's enough.  If
> not, I hope it's at least a little helpful.  Let me know if there is
> anything else I can do and I'll try to do it whenever I can.

This looks correct. Also, there's more:

httpd/parse.y:                  if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
ldapd/parse.y:                  if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
relayd/parse.y:                 if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
smtpd/parse.y:                  if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
switchd/parse.y:                        if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
ypldap/parse.y:                 if ($2 <= 0 || $2 >= (int)USHRT_MAX) {

Reply via email to