[PATCH 4/4] bb_lookup_port(): return 0 if lookup failed

Denys Vlasenko vda.linux at googlemail.com
Fri Sep 10 08:11:56 UTC 2021


On Fri, Sep 10, 2021 at 12:25 AM Sergey Ponomarev <stokito at gmail.com> wrote:
> the bb_lookup_port() is a library function and I'm not sure if it's fine to die.

It's ok to die. We can review all callers. So far I don't see which caller
needs to stay alive aftes this error.

> There are already some error messages like:
>                o_lport = bb_lookup_port(str_p, o_udpmode ? "udp" : "tcp");
>                 if (!o_lport)
>                         bb_error_msg_and_die("bad local port '%s'", str_p);

Yes. And I propose to consolidate them to one location.

> Also passing a zero port into xhost2sockaddr() will also make process die

Not really. I just tried "tftp 127.0.0.1:0 -pl README"
and it "works" in the sense that it tries to sendto()
to 127.0.0.1:0 (which makes kernel unhappy).
IOW: xhost2sockaddr("127.0.0.1:0") does not terminate.


More information about the busybox mailing list