4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 11:30:56 +08:00

* 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> 2015-02-27 Corinna Vinschen <corinna@vinschen.de>
* security.cc (alloc_sd): For directories, mark inherited ACEs * 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); max_lines * pwdgrp_buf_elem_size);
} }
lptr = eptr; lptr = eptr;
if ((this->*parse) ()) if (!(this->*parse) ())
curr_lines++; return NULL;
curr_lines++;
} }
return eptr; return eptr;
} }
@ -1459,18 +1460,18 @@ get_logon_sid ()
void * void *
pwdgrp::add_account_post_fetch (char *line, bool lock) pwdgrp::add_account_post_fetch (char *line, bool lock)
{ {
void *ret = NULL;
if (line) if (line)
{ {
void *ret;
if (lock) if (lock)
pglock.init ("pglock")->acquire (); pglock.init ("pglock")->acquire ();
add_line (line); if (add_line (line))
ret = ((char *) pwdgrp_buf) + (curr_lines - 1) * pwdgrp_buf_elem_size; ret = ((char *) pwdgrp_buf) + (curr_lines - 1) * pwdgrp_buf_elem_size;
if (lock) if (lock)
pglock.release (); pglock.release ();
return ret;
} }
return NULL; return ret;
} }
void * void *