aboutsummaryrefslogtreecommitdiff
path: root/networking/tftp.c
diff options
context:
space:
mode:
authorGravatar Denys Vlasenko <vda.linux@googlemail.com>2020-02-13 13:01:43 +0100
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2020-02-13 13:01:43 +0100
commit779df9f228789034ef23f856f855147bdb729958 (patch)
treec67a49cfd2fae5263241579590ae9cf459829f7e /networking/tftp.c
parent260bd21169843fc00ee294a5f75da9e53cb2bc14 (diff)
downloadbusybox-779df9f228789034ef23f856f855147bdb729958.tar.gz
busybox-779df9f228789034ef23f856f855147bdb729958.tar.bz2
tftp: code shrink
function old new delta tftp_protocol 1949 1947 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tftp.c')
-rw-r--r--networking/tftp.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index e74186884..4d608a6fb 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -459,16 +459,14 @@ static int tftp_protocol(
}
/* add filename and mode */
/* fill in packet if the filename fits into xbuf */
- len = strlen(remote_file) + 1;
- if (2 + len + sizeof("octet") >= io_bufsize) {
+ len = strlen(remote_file);
+ if (len + 3 + sizeof("octet") >= io_bufsize) {
bb_simple_error_msg("remote filename is too long");
goto ret;
}
- strcpy(cp, remote_file);
- cp += len;
+ cp = stpcpy(cp, remote_file) + 1;
/* add "mode" part of the packet */
- strcpy(cp, "octet");
- cp += sizeof("octet");
+ cp = stpcpy(cp, "octet");
# if ENABLE_FEATURE_TFTP_BLOCKSIZE
if (blksize == TFTP_BLKSIZE_DEFAULT && !want_transfer_size)
@@ -757,7 +755,6 @@ static int tftp_protocol(
}
#if ENABLE_TFTP
-
int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tftp_main(int argc UNUSED_PARAM, char **argv)
{
@@ -873,7 +870,6 @@ int tftp_main(int argc UNUSED_PARAM, char **argv)
}
return result;
}
-
#endif /* ENABLE_TFTP */
#if ENABLE_TFTPD
@@ -1010,7 +1006,6 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
strcpy(G_error_pkt_str, error_msg);
goto do_proto;
}
-
#endif /* ENABLE_TFTPD */
#endif /* ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT */