aboutsummaryrefslogtreecommitdiff
path: root/networking/nc_bloaty.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-09-09 22:00:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-09-09 22:00:44 +0200
commit7ab9cd23988b48956fcfe171d5828d61285baf40 (patch)
tree10b3d522ff45b06ac9dd9f362ddc336c5b058ee0 /networking/nc_bloaty.c
parent82c5eb8e4681ba345500e5c368fb54741bb0c450 (diff)
downloadbusybox-w32-7ab9cd23988b48956fcfe171d5828d61285baf40.tar.gz
busybox-w32-7ab9cd23988b48956fcfe171d5828d61285baf40.tar.bz2
busybox-w32-7ab9cd23988b48956fcfe171d5828d61285baf40.zip
libbb: make bb_lookup_port() abort on bad port names
Also, no need to preserve errno function old new delta .rodata 104247 104241 -6 bb_lookup_port 97 83 -14 nc_main 1039 1018 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-41) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r--networking/nc_bloaty.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index 25b95246f..cfa133eae 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -813,8 +813,6 @@ int nc_main(int argc UNUSED_PARAM, char **argv)
813 //if (option_mask32 & OPT_o) /* hexdump log */ 813 //if (option_mask32 & OPT_o) /* hexdump log */
814 if (option_mask32 & OPT_p) { /* local source port */ 814 if (option_mask32 & OPT_p) { /* local source port */
815 o_lport = bb_lookup_port(str_p, o_udpmode ? "udp" : "tcp", 0); 815 o_lport = bb_lookup_port(str_p, o_udpmode ? "udp" : "tcp", 0);
816 if (!o_lport)
817 bb_error_msg_and_die("bad local port '%s'", str_p);
818 } 816 }
819 //if (option_mask32 & OPT_r) /* randomize various things */ 817 //if (option_mask32 & OPT_r) /* randomize various things */
820 //if (option_mask32 & OPT_u) /* use UDP */ 818 //if (option_mask32 & OPT_u) /* use UDP */
@@ -827,9 +825,8 @@ int nc_main(int argc UNUSED_PARAM, char **argv)
827 825
828 if (argv[0]) { 826 if (argv[0]) {
829 themaddr = xhost2sockaddr(argv[0], 827 themaddr = xhost2sockaddr(argv[0],
830 argv[1] 828 bb_lookup_port(argv[1], o_udpmode ? "udp" : "tcp", 0)
831 ? bb_lookup_port(argv[1], o_udpmode ? "udp" : "tcp", 0) 829 );
832 : 0);
833 } 830 }
834 831
835 /* create & bind network socket */ 832 /* create & bind network socket */