https://bugzilla.mindrot.org/show_bug.cgi?id=2804

            Bug ID: 2804
           Summary: channels.c:3258: suspicious code ?
           Product: Portable OpenSSH
           Version: 7.6p1
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Miscellaneous
          Assignee: [email protected]
          Reporter: [email protected]

channels.c:3258]: (warning) The comparison operator in
'strcmp(listen_addr,"localhost") != 0' should maybe be '==' instead,
currently the expression 'strcmp(listen_addr,"127.0.0.1") == 0' is
redundant.

Source code is

        } else if (strcmp(listen_addr, "localhost") != 0 ||
            strcmp(listen_addr, "127.0.0.1") == 0 ||
            strcmp(listen_addr, "::1") == 0) {
            /* Accept localhost address when GatewayPorts=yes */
            addr = listen_addr;
        }

Maybe better code

        } else if (strcmp(listen_addr, "localhost") == 0 ||
            strcmp(listen_addr, "127.0.0.1") == 0 ||
            strcmp(listen_addr, "::1") == 0) {
            /* Accept localhost address when GatewayPorts=yes */
            addr = listen_addr;
        }

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
openssh-bugs mailing list
[email protected]
https://lists.mindrot.org/mailman/listinfo/openssh-bugs

Reply via email to