]> Trent Huber's Code - cbs.git/commitdiff
Use stpncpy() instead of strncpy()
authorTrent Huber <trentmhuber@gmail.com>
Wed, 26 Feb 2025 08:08:57 +0000 (03:08 -0500)
committerTrent Huber <trentmhuber@gmail.com>
Wed, 26 Feb 2025 08:08:57 +0000 (03:08 -0500)
cbs.c

diff --git a/cbs.c b/cbs.c
index 61d062c48a65e993431ac17a3235a0adfce156d0..6b44de6b522b34eebadf7522f57aa3f4abb4dfdc 100644 (file)
--- a/cbs.c
+++ b/cbs.c
@@ -31,10 +31,10 @@ char *extend(char *path, char *ext, int lib) {
    e = strlen(ext);
 
    tp = rp = alloc(d + l + b + e + 1);
-   tp = strncpy(tp, path, d);
-   tp = strncpy(tp + d, "lib", l);
-   tp = strncpy(tp + l, bp, b);
-   strncpy(tp + b, ext, e + 1);
+   tp = stpncpy(tp, path, d);
+   tp = stpncpy(tp, "lib", l);
+   tp = stpncpy(tp, bp, b);
+   stpncpy(tp, ext, e + 1);
 
    return rp;
 }