[git commit] ts: replace overlapping strcpy with shorter code

Denys Vlasenko vda.linux at googlemail.com
Tue Mar 26 10:41:35 UTC 2019


commit: https://git.busybox.net/busybox/commit/?id=3395e2a8efc92c2198620cce6f90d39bffcbb393
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
ts_main                                              401     398      -3

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 miscutils/ts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/miscutils/ts.c b/miscutils/ts.c
index c389ab89a..a2823721c 100644
--- a/miscutils/ts.c
+++ b/miscutils/ts.c
@@ -42,7 +42,8 @@ int ts_main(int argc UNUSED_PARAM, char **argv)
 		frac = is_suffixed_with(fmt_dt2str, "%.s");
 	if (frac) {
 		frac++;
-		strcpy(frac, frac + 1);
+		frac[0] = frac[1];
+		frac[1] = '\0';
 	}
 
 #define date_buf bb_common_bufsiz1


More information about the busybox-cvs mailing list