Fix bug in sysctl_string so that when a string has a length that is to

short, it gets filled uop to its length. This matches the getdomainname
and gethostname manual pages.
(getbootfile also uses this function and I think it should have the same
behaviour)

This also fixes a bug with keyinit where the seed was not saved in
/etc/skeykeys. So S/Key should be fully functional again.

Reviewed by:
Submitted by:
Obtained from:
This commit is contained in:
Guido van Rooij 1994-12-18 13:56:50 +00:00
parent 0a06ac68fe
commit f81fcd410f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5150

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
* $Id: kern_sysctl.c,v 1.18 1994/10/16 03:52:14 wollman Exp $
* $Id: kern_sysctl.c,v 1.19 1994/11/14 13:58:30 bde Exp $
*/
/*
@ -452,7 +452,7 @@ sysctl_string(oldp, oldlenp, newp, newlen, str, maxlen)
len = strlen(str) + 1;
if (oldp && *oldlenp < len)
return (ENOMEM);
len = *oldlenp;
if (newp && newlen >= maxlen)
return (EINVAL);
if (oldp) {