Re: [PATCH 06/14] newgrp: rename memset_s()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 26 February 2016, Yuriy M. Kaminskiy wrote:
> Ruediger Meier <sweet_f_a@xxxxxx> writes:
> > From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
> >
> > It's already defined in OSX standard c library.
>
> Would not it be better to just use system-provided memset_s instead
> by then? (And it is well possible glibc will provide memset_s in
> future too).

I think we should do this when there are existing Linux systems with 
memset_s. For now I don't want to do bigger changes just to be portable 
because portability is not our primary goal.

BTW it's also well possible that the affected newgrp sources may 
disappear soon anyways, see Documentation/TODO.

> > Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
> > ---
> >  login-utils/newgrp.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c
> > index 141b41b..56639d1 100644
> > --- a/login-utils/newgrp.c
> > +++ b/login-utils/newgrp.c
> > @@ -62,7 +62,7 @@ static char *xgetpass(FILE *input, const char
> > *prompt)
> >
> >  /* Ensure memory is set to value c without compiler optimization
> > getting * into way that could happen with memset(3). */
> > -static int memset_s(void *v, size_t sz, const int c)
> > +static int xmemset_s(void *v, size_t sz, const int c)
> >  {
> >  	volatile unsigned char *p = v;
> >
> > @@ -148,7 +148,7 @@ static int allow_setgid(const struct passwd
> > *pe, const struct group *ge) if (pwd && *pwd && (xpwd =
> > xgetpass(stdin, _("Password: ")))) { char *cbuf = crypt(xpwd, pwd);
> >
> > -		memset_s(xpwd, strlen(xpwd), 0);
> > +		xmemset_s(xpwd, strlen(xpwd), 0);
> >  		free(xpwd);
> >  		if (!cbuf)
> >  			warn(_("crypt failed"));
>
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux"
> in the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux