mirror of
https://github.com/sheumann/telnetd.git
synced 2024-10-31 12:04:35 +00:00
Catch malloc return failures. This should help avoid dereferencing NULL on
low-memory situations. Submitted by: kris git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@76689 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
parent
8e7393fb93
commit
ebece97cb0
@ -93,6 +93,11 @@ int server;
|
||||
xuser = (char *)malloc(512);
|
||||
pass = (char *)malloc(256);
|
||||
xpass = (char *)malloc(512);
|
||||
|
||||
if (user == NULL || xuser == NULL || pass == NULL || xpass ==
|
||||
NULL)
|
||||
return 0; /* malloc failed */
|
||||
|
||||
passwd_sent = 0;
|
||||
|
||||
genkeys(pka,ska);
|
||||
@ -534,6 +539,9 @@ auth_conv(int num_msg, const struct pam_message **msg,
|
||||
struct pam_response *reply =
|
||||
malloc(sizeof(struct pam_response) * num_msg);
|
||||
|
||||
if (reply == NULL)
|
||||
return PAM_BUF_ERR;
|
||||
|
||||
for (i = 0; i < num_msg; i++) {
|
||||
switch (msg[i]->msg_style) {
|
||||
case PAM_PROMPT_ECHO_ON: /* assume want user name */
|
||||
|
Loading…
Reference in New Issue
Block a user