In call to realloc, pass the number of bytes needed, not simply the

number of login time structures.

Forward the name of the deny capability rather than hard-coding it
in login_hostok.
This commit is contained in:
Guy Helmer 2000-12-31 16:15:06 +00:00
parent aaf7f598ae
commit 4a4ecab1c6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70544

View File

@ -101,7 +101,7 @@ login_timelist(login_cap_t *lc, char const *cap, int *ltno,
;
if (*ltno >= j)
lt = *ltptr;
else if ((lt = realloc(*ltptr, j)) != NULL) {
else if ((lt = realloc(*ltptr, j * sizeof(struct login_time))) != NULL) {
*ltno = j;
*ltptr = lt;
}
@ -188,7 +188,7 @@ login_hostok(login_cap_t *lc, const char *host, const char *ip,
rc = 0; /* host or IP not in allow list */
else {
hl = login_getcaplist(lc, "host.deny", NULL);
hl = login_getcaplist(lc, denycap, NULL);
if (hl != NULL && login_str2inlist(hl, host, ip, FNM_CASEFOLD))
rc = 0; /* host or IP in deny list */
}