aboutsummaryrefslogtreecommitdiff
path: root/libbb/safe_strncpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/safe_strncpy.c')
-rw-r--r--libbb/safe_strncpy.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/safe_strncpy.c b/libbb/safe_strncpy.c
index 649fa10cf..4acd9766b 100644
--- a/libbb/safe_strncpy.c
+++ b/libbb/safe_strncpy.c
@@ -16,3 +16,12 @@ char* FAST_FUNC safe_strncpy(char *dst, const char *src, size_t size)
dst[--size] = '\0';
return strncpy(dst, src, size);
}
+
+/* Like strcpy but can copy overlapping strings. */
+void FAST_FUNC overlapping_strcpy(char *dst, const char *src)
+{
+ while ((*dst = *src) != '\0') {
+ dst++;
+ src++;
+ }
+}