* passwd.cc (pwdgrp::parse_passwd): Eliminate use of memset. The structure
should always be completely filled out. * grp.cc (pwdgrp::parse_group): Ditto. * grp.cc (pwdgrp::parse_group): Fix off-by-one problem in allocating
This commit is contained in:
		| @@ -1,6 +1,12 @@ | |||||||
| 2003-01-26  Christopher Faylor  <cgf@redhat.com> | 2003-01-26  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
| 	* pwdgrp.cc (pwdgrp::parse_group): Fix off-by-one problem in allocating | 	* passwd.cc (pwdgrp::parse_passwd): Eliminate use of memset.  The | ||||||
|  | 	structure should always be completely filled out. | ||||||
|  | 	* grp.cc (pwdgrp::parse_group): Ditto. | ||||||
|  |  | ||||||
|  | 2003-01-26  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
|  | 	* grp.cc (pwdgrp::parse_group): Fix off-by-one problem in allocating | ||||||
| 	gr_mem. | 	gr_mem. | ||||||
|  |  | ||||||
| 2003-01-26  Christopher Faylor  <cgf@redhat.com> | 2003-01-26  Christopher Faylor  <cgf@redhat.com> | ||||||
|   | |||||||
| @@ -36,12 +36,7 @@ static char * NO_COPY null_ptr; | |||||||
| bool | bool | ||||||
| pwdgrp::parse_group () | pwdgrp::parse_group () | ||||||
| { | { | ||||||
|   char *dp; |  | ||||||
|  |  | ||||||
| # define grp (*group_buf)[curr_lines] | # define grp (*group_buf)[curr_lines] | ||||||
|  |  | ||||||
|   memset (&grp, 0, sizeof (grp)); |  | ||||||
|  |  | ||||||
|   grp.gr_name = next_str (); |   grp.gr_name = next_str (); | ||||||
|   if (!*grp.gr_name) |   if (!*grp.gr_name) | ||||||
|     return false; |     return false; | ||||||
| @@ -52,7 +47,7 @@ pwdgrp::parse_group () | |||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
|   int n; |   int n; | ||||||
|   dp = raw_ptr (); |   char *dp = raw_ptr (); | ||||||
|   for (n = 0; *next_str (','); n++) |   for (n = 0; *next_str (','); n++) | ||||||
|     continue; |     continue; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -38,9 +38,6 @@ bool | |||||||
| pwdgrp::parse_passwd () | pwdgrp::parse_passwd () | ||||||
| { | { | ||||||
| # define res (*passwd_buf)[curr_lines] | # define res (*passwd_buf)[curr_lines] | ||||||
|  |  | ||||||
|   memset (&res, 0, sizeof (res)); |  | ||||||
|  |  | ||||||
|   res.pw_name = next_str (); |   res.pw_name = next_str (); | ||||||
|   res.pw_passwd = next_str (); |   res.pw_passwd = next_str (); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user