summaryrefslogtreecommitdiff
path: root/sessreg.c
diff options
context:
space:
mode:
Diffstat (limited to 'sessreg.c')
-rw-r--r--sessreg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sessreg.c b/sessreg.c
index 7725bcc..9680851 100644
--- a/sessreg.c
+++ b/sessreg.c
@@ -192,6 +192,12 @@ sysnerr (int x, const char *s)
return x;
}
+/*
+ * While this looks like it could be replaced with strlcpy() on platforms
+ * that have it, we're sticking with strncpy() so that we zero out the
+ * whole buffer to avoid writing garbage to the fixed length fields in the
+ * utmp/wtmp files, since strlcpy() does not write past the \0 terminator.
+ */
static void
safe_strncpy(char *dest, const char *src, size_t n)
{