aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-06-17 19:23:41 +0200
committerToni Uhlig <matzeton@googlemail.com>2018-06-17 19:23:41 +0200
commit7c38b9781f60e4a5ae46092783a71a132506a5aa (patch)
treebf95790b4147628901725b37e2c099c6862d6e93 /src/utils.c
parent946880094ff17bd7031c1059625290c4fd2a76d5 (diff)
added snprintf autoconf and runtime check
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 3de57a2..69d7b81 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -882,3 +882,20 @@ size_t parse_hostport_str(const char *str, char hbuf[NI_MAXHOST],
return siz;
}
+
+int selfcheck_minimal_requirements(void)
+{
+ int s;
+ char buf[32] = {0};
+ char test[64] = {0};
+
+ memset(&test[0], 'A', sizeof test);
+ test[sizeof test - 1] = 0;
+ s = snprintf(buf, sizeof buf, "%s", &test[0]);
+ if (s != sizeof test - 1)
+ return 1;
+ if (buf[sizeof buf - 1] != 0)
+ return 1;
+
+ return 0;
+}