summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRenato Westphal <renato@openbsd.org>2019-03-01 21:06:29 +0100
committerGitHub <noreply@github.com>2019-03-01 21:06:29 +0100
commitfe39eb421e9d4567744ef7f9a402c1224093ec74 (patch)
tree767fc14803eebd2042eac4d551ea0c7468bf105b /lib
parentMerge pull request #3882 from vivek-cumulus/refine_evpn_route_add (diff)
parentpimd: strncpy -> strlcpy (diff)
downloadfrr-fe39eb421e9d4567744ef7f9a402c1224093ec74.tar.xz
frr-fe39eb421e9d4567744ef7f9a402c1224093ec74.zip
Merge pull request #3877 from qlyoung/remove-strncpy
Remove strncpy
Diffstat (limited to 'lib')
-rw-r--r--lib/event_counter.c2
-rw-r--r--lib/prefix.c6
-rw-r--r--lib/yang_translator.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/event_counter.c b/lib/event_counter.c
index c520937a3..57dbfb5fd 100644
--- a/lib/event_counter.c
+++ b/lib/event_counter.c
@@ -62,7 +62,7 @@ const char *event_counter_format(const struct event_counter *counter)
|| strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %T %z",
last_change)
== 0) {
- strncpy(timebuf, "???", sizeof(timebuf));
+ strlcpy(timebuf, "???", sizeof(timebuf));
}
snprintf(rv, sizeof(rv), "%5llu last: %s", counter->count,
diff --git a/lib/prefix.c b/lib/prefix.c
index babd4304d..80a89cc3c 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -866,7 +866,7 @@ int str2prefix_ipv4(const char *str, struct prefix_ipv4 *p)
return ret;
} else {
cp = XMALLOC(MTYPE_TMP, (pnt - str) + 1);
- strncpy(cp, str, pnt - str);
+ memcpy(cp, str, pnt - str);
*(cp + (pnt - str)) = '\0';
ret = inet_aton(cp, &p->prefix);
XFREE(MTYPE_TMP, cp);
@@ -913,7 +913,7 @@ int str2prefix_eth(const char *str, struct prefix_eth *p)
}
cp = XMALLOC(MTYPE_TMP, (pnt - str) + 1);
- strncpy(cp, str, pnt - str);
+ memcpy(cp, str, pnt - str);
*(cp + (pnt - str)) = '\0';
str_addr = cp;
@@ -1030,7 +1030,7 @@ int str2prefix_ipv6(const char *str, struct prefix_ipv6 *p)
int plen;
cp = XMALLOC(MTYPE_TMP, (pnt - str) + 1);
- strncpy(cp, str, pnt - str);
+ memcpy(cp, str, pnt - str);
*(cp + (pnt - str)) = '\0';
ret = inet_pton(AF_INET6, cp, &p->prefix);
XFREE(MTYPE_TMP, cp);
diff --git a/lib/yang_translator.c b/lib/yang_translator.c
index 6d6f92836..76a6cc5fd 100644
--- a/lib/yang_translator.c
+++ b/lib/yang_translator.c
@@ -511,7 +511,7 @@ static void str_replace(char *o_string, const char *s_string,
if (!ch)
return;
- strncpy(buffer, o_string, ch - o_string);
+ memcpy(buffer, o_string, ch - o_string);
buffer[ch - o_string] = 0;
sprintf(buffer + (ch - o_string), "%s%s", r_string,