- Fix NULL pointer dereference in login.c. Fix from Andre Lucas

<andre.lucas@dial.pipex.com>
This commit is contained in:
Damien Miller 2000-01-26 11:04:48 +11:00
parent 68cee109e8
commit d89c24b57e
2 changed files with 35 additions and 27 deletions

View File

@ -1,3 +1,7 @@
20000125
- Fix NULL pointer dereference in login.c. Fix from Andre Lucas
<andre.lucas@dial.pipex.com>
20000124 20000124
- Pick up version 1.2.2 from OpenBSD CVS (no changes, just version number - Pick up version 1.2.2 from OpenBSD CVS (no changes, just version number
increment) increment)

View File

@ -18,7 +18,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$Id: login.c,v 1.19 2000/01/23 09:18:36 damien Exp $"); RCSID("$Id: login.c,v 1.20 2000/01/26 00:04:48 damien Exp $");
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
# include <utmpx.h> # include <utmpx.h>
@ -173,6 +173,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
strncpy(u.ut_host, host, sizeof(u.ut_host)); strncpy(u.ut_host, host, sizeof(u.ut_host));
#endif #endif
#if defined(HAVE_ADDR_IN_UTMP) #if defined(HAVE_ADDR_IN_UTMP)
if (addr) {
switch (addr->sa_family) { switch (addr->sa_family) {
case AF_INET: { case AF_INET: {
struct sockaddr_in *in = (struct sockaddr_in*)addr; struct sockaddr_in *in = (struct sockaddr_in*)addr;
@ -189,6 +190,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
default: default:
break; break;
} }
}
#endif #endif
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
@ -208,6 +210,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
# endif /* HAVE_SYSLEN_IN_UTMPX */ # endif /* HAVE_SYSLEN_IN_UTMPX */
# endif # endif
#if defined(HAVE_ADDR_IN_UTMPX) #if defined(HAVE_ADDR_IN_UTMPX)
if (addr)
switch (addr->sa_family) { switch (addr->sa_family) {
case AF_INET: { case AF_INET: {
struct sockaddr_in *in = (struct sockaddr_in*)addr; struct sockaddr_in *in = (struct sockaddr_in*)addr;
@ -224,6 +227,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
default: default:
break; break;
} }
}
#endif #endif
#endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */ #endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */