From: Joshua Brindle <jbrindle@tresys.com>
To: russell@coker.com.au
Cc: Steve G <linux_4ever@yahoo.com>,
Ulrich Drepper <drepper@redhat.com>,
SE-Linux <selinux@tycho.nsa.gov>,
Daniel Walsh <dwalsh@redhat.com>,
"Stephen C. Tweedie" <sct@redhat.com>
Subject: Re: setfiles and restorecon performance patch
Date: Tue, 03 Jan 2006 15:22:43 -0500 [thread overview]
Message-ID: <43BADD13.30603@tresys.com> (raw)
In-Reply-To: <200601040608.56218.russell@coker.com.au>
Russell Coker wrote:
> On Wednesday 04 January 2006 02:55, Steve G <linux_4ever@yahoo.com> wrote:
>
>>>@@ -143,7 +141,7 @@ int restore(char *filename) {
>>> if (verbose>1)
>>> fprintf(stderr,"Warning! %s refers to a symbolic link, not
>>>following last component.\n", filename);
>>> char *p = NULL, *file_sep;
>>>- char *tmp_path = strdup(filename);
>>>+ char *tmp_path = strdupa(filename);
>>> if (!tmp_path) {
>>> fprintf(stderr,"strdup on %s failed: %s\n",
>>>
>>>>filename,strerror(errno));
>>
>>Do you need to check for NULL on strdupa calls? If so, the error message
>>needs to have the function updated, too. Otherwise this can be deleted.
>
>
> Not sure. The alloca() man page says that the failure result is undefined but
> the strdupa() man page says nothing (implies that it's the same as strdup()).
>
> Ulrich?
>
>
>>>@@ -155,14 +153,16 @@ int restore(char *filename) {
>>> file_sep++;
>>> p = realpath(tmp_path, path);
>>> }
>>>- if (!p || strlen(path) + strlen(file_sep) + 1 > PATH_MAX) {
>>>+ size_t len = strlen(p);
>>>+ if (!p || len + strlen(file_sep) + 2 > PATH_MAX) {
>>
>>What if realpath returned NULL? strlen is using a NULL pointer and then p
>>is checked in the second line to see if its NULL.
>
>
> Fixed that, attached a new patch.
strdupa man page says it's a GNU extension, does this work on BSD? We
should not be making non-portable changes to libraries as SEBSD has the
potential to catch up and start using these new libraries.
--
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-01-03 20:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-03 8:59 setfiles and restorecon performance patch Russell Coker
2006-01-03 15:55 ` Steve G
2006-01-03 19:08 ` Russell Coker
2006-01-03 20:22 ` Joshua Brindle [this message]
2006-01-07 1:19 ` Stephen Tweedie
2006-01-13 13:55 ` Stephen Smalley
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=43BADD13.30603@tresys.com \
--to=jbrindle@tresys.com \
--cc=drepper@redhat.com \
--cc=dwalsh@redhat.com \
--cc=linux_4ever@yahoo.com \
--cc=russell@coker.com.au \
--cc=sct@redhat.com \
--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.