From bdbd7fb6b9c446616197f9da32071f52d3bbd96f Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 26 Jan 2003 06:02:34 +0000 Subject: [PATCH] * 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 --- winsup/cygwin/ChangeLog | 8 +++++++- winsup/cygwin/grp.cc | 7 +------ winsup/cygwin/passwd.cc | 3 --- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3baf1b05e..629a04bc5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,6 +1,12 @@ 2003-01-26 Christopher Faylor - * 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 + + * grp.cc (pwdgrp::parse_group): Fix off-by-one problem in allocating gr_mem. 2003-01-26 Christopher Faylor diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 7d7f373a2..dc93f913c 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -36,12 +36,7 @@ static char * NO_COPY null_ptr; bool pwdgrp::parse_group () { - char *dp; - # define grp (*group_buf)[curr_lines] - - memset (&grp, 0, sizeof (grp)); - grp.gr_name = next_str (); if (!*grp.gr_name) return false; @@ -52,7 +47,7 @@ pwdgrp::parse_group () return false; int n; - dp = raw_ptr (); + char *dp = raw_ptr (); for (n = 0; *next_str (','); n++) continue; diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index fe21299b2..113f92acf 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -38,9 +38,6 @@ bool pwdgrp::parse_passwd () { # define res (*passwd_buf)[curr_lines] - - memset (&res, 0, sizeof (res)); - res.pw_name = next_str (); res.pw_passwd = next_str ();