diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | login.c | 58 |
2 files changed, 35 insertions, 27 deletions
@@ -1,3 +1,7 @@ | |||
1 | 20000125 | ||
2 | - Fix NULL pointer dereference in login.c. Fix from Andre Lucas | ||
3 | <andre.lucas@dial.pipex.com> | ||
4 | |||
1 | 20000124 | 5 | 20000124 |
2 | - Pick up version 1.2.2 from OpenBSD CVS (no changes, just version number | 6 | - Pick up version 1.2.2 from OpenBSD CVS (no changes, just version number |
3 | increment) | 7 | increment) |
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: login.c,v 1.19 2000/01/23 09:18:36 damien Exp $"); | 21 | RCSID("$Id: login.c,v 1.20 2000/01/26 00:04:48 damien Exp $"); |
22 | 22 | ||
23 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) | 23 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
24 | # include <utmpx.h> | 24 | # include <utmpx.h> |
@@ -173,21 +173,23 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, | |||
173 | strncpy(u.ut_host, host, sizeof(u.ut_host)); | 173 | strncpy(u.ut_host, host, sizeof(u.ut_host)); |
174 | #endif | 174 | #endif |
175 | #if defined(HAVE_ADDR_IN_UTMP) | 175 | #if defined(HAVE_ADDR_IN_UTMP) |
176 | switch (addr->sa_family) { | 176 | if (addr) { |
177 | case AF_INET: { | 177 | switch (addr->sa_family) { |
178 | struct sockaddr_in *in = (struct sockaddr_in*)addr; | 178 | case AF_INET: { |
179 | memcpy(&(u.ut_addr), &(in->sin_addr), sizeof(&(in->sin_addr))); | 179 | struct sockaddr_in *in = (struct sockaddr_in*)addr; |
180 | break; | 180 | memcpy(&(u.ut_addr), &(in->sin_addr), sizeof(&(in->sin_addr))); |
181 | } | 181 | break; |
182 | } | ||
182 | #if defined(HAVE_ADDR_V6_IN_UTMP) | 183 | #if defined(HAVE_ADDR_V6_IN_UTMP) |
183 | case AF_INET6: { | 184 | case AF_INET6: { |
184 | struct sockaddr_in6 *in6 = (struct sockaddr_in6*)addr; | 185 | struct sockaddr_in6 *in6 = (struct sockaddr_in6*)addr; |
185 | memcpy(u.ut_addr_v6, &(in6->sin6_addr), sizeof(&(in6->sin6_addr))); | 186 | memcpy(u.ut_addr_v6, &(in6->sin6_addr), sizeof(&(in6->sin6_addr))); |
186 | break; | 187 | break; |
187 | } | 188 | } |
188 | #endif | 189 | #endif |
189 | default: | 190 | default: |
190 | break; | 191 | break; |
192 | } | ||
191 | } | 193 | } |
192 | #endif | 194 | #endif |
193 | 195 | ||
@@ -208,21 +210,23 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, | |||
208 | # endif /* HAVE_SYSLEN_IN_UTMPX */ | 210 | # endif /* HAVE_SYSLEN_IN_UTMPX */ |
209 | # endif | 211 | # endif |
210 | #if defined(HAVE_ADDR_IN_UTMPX) | 212 | #if defined(HAVE_ADDR_IN_UTMPX) |
211 | switch (addr->sa_family) { | 213 | if (addr) |
212 | case AF_INET: { | 214 | switch (addr->sa_family) { |
213 | struct sockaddr_in *in = (struct sockaddr_in*)addr; | 215 | case AF_INET: { |
214 | memcpy(&(utx.ut_addr), &(in->sin_addr), sizeof(&(in->sin_addr))); | 216 | struct sockaddr_in *in = (struct sockaddr_in*)addr; |
215 | break; | 217 | memcpy(&(utx.ut_addr), &(in->sin_addr), sizeof(&(in->sin_addr))); |
216 | } | 218 | break; |
219 | } | ||
217 | #if defined(HAVE_ADDR_V6_IN_UTMPX) | 220 | #if defined(HAVE_ADDR_V6_IN_UTMPX) |
218 | case AF_INET6: { | 221 | case AF_INET6: { |
219 | struct sockaddr_in6 *in6 = (struct sockaddr_in6*)addr; | 222 | struct sockaddr_in6 *in6 = (struct sockaddr_in6*)addr; |
220 | memcpy(utx.ut_addr_v6, &(in6->sin6_addr), sizeof(&(in6->sin6_addr))); | 223 | memcpy(utx.ut_addr_v6, &(in6->sin6_addr), sizeof(&(in6->sin6_addr))); |
221 | break; | 224 | break; |
222 | } | 225 | } |
223 | #endif | 226 | #endif |
224 | default: | 227 | default: |
225 | break; | 228 | break; |
229 | } | ||
226 | } | 230 | } |
227 | #endif | 231 | #endif |
228 | #endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */ | 232 | #endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */ |