diff options
author | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-06-21 05:37:21 +0000 |
---|---|---|
committer | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-06-21 05:37:21 +0000 |
commit | 5f3b4d6fe4734e4ef1746a0c5d305370d3d29487 (patch) | |
tree | 1bc552faf6e438089648f85db547402d7dca2e0e /usr.bin/mg/help.c | |
parent | 392745f91df219566154c00a216cb986dcb44574 (diff) |
fix bad usage of strlcpy()'s return value. (made pointers point
beyond the boundaries of buffers)
ok deraadt@
Diffstat (limited to 'usr.bin/mg/help.c')
-rw-r--r-- | usr.bin/mg/help.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c index 8b9e00c3c04..f16bc79441d 100644 --- a/usr.bin/mg/help.c +++ b/usr.bin/mg/help.c @@ -1,4 +1,4 @@ -/* $OpenBSD: help.c,v 1.17 2002/03/16 19:30:29 vincent Exp $ */ +/* $OpenBSD: help.c,v 1.18 2002/06/21 05:37:20 vincent Exp $ */ /* * Help functions for Mg 2 @@ -28,7 +28,7 @@ desckey(f, n) { KEYMAP *curmap; PF funct; - int c, m, i; + int c, m, i, num; char *pep; char prompt[80]; @@ -36,7 +36,10 @@ desckey(f, n) if (inmacro) return TRUE; /* ignore inside keyboard macro */ #endif /* !NO_MACRO */ - pep = prompt + strlcpy(prompt, "Describe key briefly: ", sizeof(prompt)); + num = strlcpy(prompt, "Describe key briefly: ", sizeof(prompt)); + if (num >= sizeof prompt) + num = sizeof prompt - 1; + pep = prompt + num; key.k_count = 0; m = curbp->b_nmodes; curmap = curbp->b_modes[m]->p_map; |