* uinfo.cc (pwdgrp::add_line): Return NULL if parsing a line failed.

(pwdgrp::add_account_post_fetch): Check return value from add_line and
	return NULL if add_line returns NULL.
This commit is contained in:
Corinna Vinschen 2015-02-28 12:12:34 +00:00
parent fab17cf934
commit 146200310f
2 changed files with 14 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2015-02-28 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (pwdgrp::add_line): Return NULL if parsing a line failed.
(pwdgrp::add_account_post_fetch): Check return value from add_line and
return NULL if add_line returns NULL.
2015-02-27 Corinna Vinschen <corinna@vinschen.de>
* security.cc (alloc_sd): For directories, mark inherited ACEs

View File

@ -574,8 +574,9 @@ pwdgrp::add_line (char *eptr)
max_lines * pwdgrp_buf_elem_size);
}
lptr = eptr;
if ((this->*parse) ())
curr_lines++;
if (!(this->*parse) ())
return NULL;
curr_lines++;
}
return eptr;
}
@ -1459,18 +1460,18 @@ get_logon_sid ()
void *
pwdgrp::add_account_post_fetch (char *line, bool lock)
{
void *ret = NULL;
if (line)
{
void *ret;
if (lock)
pglock.init ("pglock")->acquire ();
add_line (line);
ret = ((char *) pwdgrp_buf) + (curr_lines - 1) * pwdgrp_buf_elem_size;
if (add_line (line))
ret = ((char *) pwdgrp_buf) + (curr_lines - 1) * pwdgrp_buf_elem_size;
if (lock)
pglock.release ();
return ret;
}
return NULL;
return ret;
}
void *