summaryrefslogtreecommitdiff
path: root/usr.bin/mg/cinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mg/cinfo.c')
-rw-r--r--usr.bin/mg/cinfo.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mg/cinfo.c b/usr.bin/mg/cinfo.c
index f77958040df..8ae29418c8f 100644
--- a/usr.bin/mg/cinfo.c
+++ b/usr.bin/mg/cinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cinfo.c,v 1.8 2002/03/11 13:02:56 vincent Exp $ */
+/* $OpenBSD: cinfo.c,v 1.9 2002/05/06 19:22:38 deraadt Exp $ */
/*
* Character class tables.
@@ -93,6 +93,7 @@ char *
keyname(char *cp, size_t len, int k)
{
const char *np;
+ size_t copied;
if (k < 0)
k = CHARMASK(k);/* sign extended char */
@@ -143,5 +144,8 @@ keyname(char *cp, size_t len, int k)
*cp = '\0';
return cp;
}
- return cp + strlcpy(cp, np, len);
+ copied = strlcpy(cp, np, len);
+ if (copied >= len)
+ copied = len - 1;
+ return cp + copied;
}