Date: Fri, 17 Aug 2001 09:48:37 -0400 (EDT) From: "Andrew R. Reiter" <arr@watson.org> To: audit@freebsd.org Subject: rshd.c diff [openbsd updates] Message-ID: <Pine.NEB.3.96L.1010817094643.7968A-200000@fledge.watson.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] hi, Patch for moving strncpy's to strlcpy's is attached... And can also be found at: http://www.watson.org/fbsd-audit/libexec/rshd/rshd.c.08172001.diff ...more openbsd->fbsd patches... hehe exciting ;-) andrew *-------------................................................. | Andrew R. Reiter | arr@fledge.watson.org | "It requires a very unusual mind | to undertake the analysis of the obvious" -- A.N. Whitehead [-- Attachment #2 --] --- rshd.c.orig Fri Aug 17 15:41:16 2001 +++ rshd.c Fri Aug 17 15:45:09 2001 @@ -403,8 +403,7 @@ retcode = pam_authenticate(pamh, 0); if (retcode == PAM_SUCCESS) { if ((retcode = pam_get_item(pamh, PAM_USER, (const void **) &cp)) == PAM_SUCCESS) { - strncpy(locuser, cp, sizeof(locuser)); - locuser[sizeof(locuser) - 1] = '\0'; + strlcpy(locuser, cp, sizeof(locuser)-1); } else syslog(LOG_ERR|LOG_AUTH, "pam_get_item(PAM_USER): %s", pam_strerror(pamh, retcode)); @@ -466,9 +465,7 @@ if (lc != NULL && fromp->su_family == AF_INET) { /*XXX*/ char remote_ip[MAXHOSTNAMELEN]; - strncpy(remote_ip, numericname, - sizeof(remote_ip) - 1); - remote_ip[sizeof(remote_ip) - 1] = 0; + strlcpy(remote_ip, numericname, sizeof(remote_ip) - 1); if (!auth_hostok(lc, fromhost, remote_ip)) { syslog(LOG_INFO|LOG_AUTH, "%s@%s as %s: permission denied (%s). cmd='%.80s'",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1010817094643.7968A-200000>
