and terminate it. This patch ensures passwords will be the correct length of 8,
which is what is implied in the source (but not reflected in the man page).
PR: bin/7817
Reviewed by: Alfred Perlstein <bright@hotjobs.com>
Submitted by: Hiroshi Nishikawa <nis@pluto.dti.ne.jp>
#ifndef lint
static const char rcsid[] =
- "$Id$";
+ "$Id: pw_user.c,v 1.23 1997/10/10 06:23:39 charnier Exp $";
#endif /* not lint */
#include <ctype.h>
l = (random() % 8 + 8); /* 8 - 16 chars */
pw_getrand(rndbuf, l);
for (i = 0; i < l; i++)
- pwbuf[i] = chars[rndbuf[i] % sizeof(chars)];
+ pwbuf[i] = chars[rndbuf[i] % (sizeof(chars)-1)];
pwbuf[i] = '\0';
/*