summaryrefslogtreecommitdiff
path: root/m4/ax_check_user_namespace.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/ax_check_user_namespace.m4')
-rw-r--r--m4/ax_check_user_namespace.m47
1 files changed, 5 insertions, 2 deletions
diff --git a/m4/ax_check_user_namespace.m4 b/m4/ax_check_user_namespace.m4
index 27ba698..aca7216 100644
--- a/m4/ax_check_user_namespace.m4
+++ b/m4/ax_check_user_namespace.m4
@@ -8,6 +8,9 @@
#
# This macro checks whether the local system supports Linux user namespaces.
# If so, it calls AC_DEFINE(HAVE_USER_NAMESPACE).
+#
+# Copyright (C) The c-ares team
+# SPDX-License-Identifier: MIT
AC_DEFUN([AX_CHECK_USER_NAMESPACE],[dnl
AC_CACHE_CHECK([whether user namespaces are supported],
@@ -34,9 +37,9 @@ int main() {
pid_t child = clone(userfn, userst + 1024*1024, CLONE_NEWUSER|SIGCHLD, 0);
if (child < 0) return 1;
- sprintf(buffer, "/proc/%d/uid_map", child);
+ snprintf(buffer, sizeof(buffer), "/proc/%d/uid_map", child);
fd = open(buffer, O_CREAT|O_WRONLY|O_TRUNC, 0755);
- sprintf(buffer, "0 %d 1\n", getuid());
+ snprintf(buffer, sizeof(buffer), "0 %d 1\n", getuid());
write(fd, buffer, strlen(buffer));
close(fd);