Re: [dev] [sbase] [PATCH 1/4] tar: Don't crash when get{pw,gr}uid fails

From: Michael Forney <mforney_AT_mforney.org>
Date: Sat, 1 Nov 2014 15:01:11 -0700

On Sat, Nov 01, 2014 at 08:57:12PM +0000, Dimitris Papastamos wrote:
> On Sat, Nov 01, 2014 at 08:36:37PM +0000, Michael Forney wrote:
> > - snprintf(h->uname, sizeof h->uname, "%s", pw->pw_name);
> > - snprintf(h->gname, sizeof h->gname, "%s", gr->gr_name);
> > + snprintf(h->uname, sizeof h->uname, "%s", pw ? pw->pw_name : "");
> > + snprintf(h->gname, sizeof h->gname, "%s", gr ? gr->gr_name : "");
>
> The patches look good, thanks!
>
> Just a small clarification on this one, do other tar implementations
> do the same here?

It looks like GNU tar does¹, but BSD tar uses the string
representation of the UID/GID.

¹ http://git.savannah.gnu.org/cgit/tar.git/tree/src/names.c#n66

-- 
Michael Forney <mforney_AT_mforney.org>

Received on Sat Nov 01 2014 - 23:01:11 CET

This archive was generated by hypermail 2.3.0 : Sat Nov 01 2014 - 23:12:07 CET