Todd C. Miller wrote:
> On Mon, 25 Apr 2016 22:39:48 +0200, Jeremie Courreges-Anglas wrote:
> 
> > Agreed, I also had this in mind.  But then, should the memset call with
> > a zero size be avoided?
> > 
> >     if (lastenv != environ)
> >             memcpy(P, environ, cnt * sizeof(char *));
> 
> I thought about that too.  Strictly speaking it is undefined behavior
> to pass in a NULL pointer, regardless of size.  However, it is safe
> on OpenBSD and we have plenty of other code that assumes this.

compilers will, however, "miscompile" such code. we should avoid it.

Reply via email to