aboutsummaryrefslogtreecommitdiffstats
path: root/ip
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-09-01 18:52:54 +0200
committerStephen Hemminger <stephen@networkplumber.org>2017-09-01 12:10:54 -0700
commit44cc6c792a6503e024f042c65f35cd44b3283b20 (patch)
treea1b833ac6ec68f5aa9e74823782c19bb39403660 /ip
parent532b8874fe545acaa8d45c4dd3b54b8f3bb41d9f (diff)
downloadplatform_external_iproute2-44cc6c792a6503e024f042c65f35cd44b3283b20.tar.gz
platform_external_iproute2-44cc6c792a6503e024f042c65f35cd44b3283b20.tar.bz2
platform_external_iproute2-44cc6c792a6503e024f042c65f35cd44b3283b20.zip
ipxfrm: Replace STRBUF_CAT macro with strlcat()
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'ip')
-rw-r--r--ip/ipxfrm.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index d5eb22e2..12c2f721 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -40,17 +40,6 @@
#include "ip_common.h"
#define STRBUF_SIZE (128)
-#define STRBUF_CAT(buf, str) \
- do { \
- int rest = sizeof(buf) - 1 - strlen(buf); \
- if (rest > 0) { \
- int len = strlen(str); \
- if (len > rest) \
- len = rest; \
- strncat(buf, str, len); \
- buf[sizeof(buf) - 1] = '\0'; \
- } \
- } while (0);
struct xfrm_filter filter;
@@ -902,8 +891,8 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
prefix, title);
if (prefix)
- STRBUF_CAT(buf, prefix);
- STRBUF_CAT(buf, "\t");
+ strlcat(buf, prefix, sizeof(buf));
+ strlcat(buf, "\t", sizeof(buf));
fputs(buf, fp);
fprintf(fp, "replay-window %u ", xsinfo->replay_window);
@@ -944,7 +933,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
char sbuf[STRBUF_SIZE];
memcpy(sbuf, buf, sizeof(sbuf));
- STRBUF_CAT(sbuf, "sel ");
+ strlcat(sbuf, "sel ", sizeof(sbuf));
xfrm_selector_print(&xsinfo->sel, xsinfo->family, fp, sbuf);
}
@@ -992,8 +981,8 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
}
if (prefix)
- STRBUF_CAT(buf, prefix);
- STRBUF_CAT(buf, "\t");
+ strlcat(buf, prefix, sizeof(buf));
+ strlcat(buf, "\t", sizeof(buf));
fputs(buf, fp);
if (xpinfo->dir >= XFRM_POLICY_MAX) {