summaryrefslogtreecommitdiff
path: root/usr.bin/mg/cinfo.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-23 23:29:49 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-23 23:29:49 +0000
commite7a62e8b70512d812cef6b70fd4e322f433d557b (patch)
tree88b8cc78f626da6c454f8d1c617cf0100bb0a50a /usr.bin/mg/cinfo.c
parentdb83c7d6226b74232b49ac18d7337c50194f21be (diff)
cinfo is const, keyname() and findbind() take buffer size to use strlcpy vs cpy+len
Diffstat (limited to 'usr.bin/mg/cinfo.c')
-rw-r--r--usr.bin/mg/cinfo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/mg/cinfo.c b/usr.bin/mg/cinfo.c
index 429c57f3f68..c2d9a775b90 100644
--- a/usr.bin/mg/cinfo.c
+++ b/usr.bin/mg/cinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cinfo.c,v 1.5 2001/05/23 22:20:35 art Exp $ */
+/* $OpenBSD: cinfo.c,v 1.6 2001/05/23 23:29:47 mickey Exp $ */
/*
* Character class tables.
@@ -17,7 +17,7 @@
* character set, and lets me ask some questions that the
* standard "ctype" macros cannot ask.
*/
-char cinfo[256] = {
+const char cinfo[256] = {
_C, _C, _C, _C, /* 0x0X */
_C, _C, _C, _C,
_C, _C, _C, _C,
@@ -90,9 +90,10 @@ char cinfo[256] = {
* '\0'.
*/
char *
-keyname(cp, k)
- char *cp;
- int k;
+keyname(cp, len, k)
+ char *cp;
+ size_t len;
+ int k;
{
char *np;
@@ -145,6 +146,5 @@ keyname(cp, k)
*cp = '\0';
return cp;
}
- strcpy(cp, np);
- return cp + strlen(cp);
+ return cp + strlcpy(cp, np, len);
}