From: Michael C Thompson <thompsmc@us.ibm.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: SE Linux <selinux@tycho.nsa.gov>
Subject: Re: [PATCH 1/4] make newrole suid
Date: Tue, 10 Oct 2006 16:44:41 -0500 [thread overview]
Message-ID: <452C1449.3040207@us.ibm.com> (raw)
In-Reply-To: <1160512579.3322.57.camel@moss-spartans.epoch.ncsc.mil>
Stephen Smalley wrote:
> On Tue, 2006-10-10 at 16:27 -0400, Stephen Smalley wrote:
>> On Fri, 2006-10-06 at 17:14 -0500, Michael C Thompson wrote:
>> + fprintf(stderr,
>> + _("cannot find valid entry in the passwd file.\n"));
>> + return -1;
>> + }
>> +
>> + *pw_copy = *pw;
>> + pw = pw_copy;
>> + pw->pw_name = xstrdup(pw->pw_name);
>> + pw->pw_dir = xstrdup(pw->pw_dir);
>> + pw->pw_shell = xstrdup(pw->pw_shell);
>> +
>> + if (! (pw->pw_name && pw->pw_dir && pw->pw_shell))
>> + goto out_free;
>>
>> xstrdup by definition exits on OOM errors, so you don't have to re-test
>> here, or alternatively you don't need to use xstrdup in the first place
>> (vs. just plain strdup).
>
> Ok, I see that in patch 3, you drop the exit call from xstrdup. Which I
> think is a mistake - xmalloc/xstrdup-style functions typically mean
> "succeed or exit".
Right, I can see that now. I'll admit ignorance: I wasn't aware that was
what the x prefix meant - I've never used that naming style before. I
would rather not exit mid-code, so I'll change the use to be strdup and
perform the checks.
Thanks,
Mike
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2006-10-10 21:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-06 22:14 [PATCH 1/4] make newrole suid Michael C Thompson
2006-10-10 20:27 ` Stephen Smalley
2006-10-10 20:36 ` Stephen Smalley
2006-10-10 21:44 ` Michael C Thompson [this message]
2006-10-10 21:40 ` Michael C Thompson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=452C1449.3040207@us.ibm.com \
--to=thompsmc@us.ibm.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.