diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-06 19:22:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-06 19:22:39 +0000 |
commit | aced4eb90185865a63d1bb921f12955537ca108d (patch) | |
tree | a52aedb75bc1304839277388bb5126c1776f95e4 /usr.bin | |
parent | 596f1ac4d205bdc68fd2c3fb4758d034a13b7df2 (diff) |
different fix; reported by zyrnix@users.sourceforge.net
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/cinfo.c | 8 |
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; } |