Research Menu

.
Skip Search Box

SELinux Mailing List

Re: libsemanage patch

From: Daniel J Walsh <dwalsh_at_redhat.com>
Date: Mon, 03 Dec 2007 15:49:44 -0500


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen Smalley wrote:

> On Mon, 2007-12-03 at 14:51 -0500, Todd Miller wrote:

>> Daniel J Walsh wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> genhomedircon includes the "\n" in /etc/shells so no shells in the
>>> /etc/passwd match.
>> Isn't this going to cause problems if the last line in /etc/shells has
>> no newline?
>>
>> Instead of:
>> temp[strlen(temp)-1]=0;
>>
>> I would use:
>> temp[strcspn(temp, "\n")] = '\0';
>>
>> That will overwrite the first newline with a NUL or, if there is no
>> newline, the terminating NUL will be overwritten with another NUL, which
>> is harmless. It is a useful idiom...
> 
> Given that getline() returns the length read (not to be confused with
> the buffer length), why not just:
> 	while ((len = getline(&temp, &buff_len, shells)) > 0) {
> 		if (temp[len-1] == '\n') temp[len-1] = 0;
> 

Second try.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHVGvnrlYvE4MpobMRAhxfAJ4vuvC1uijEUDqFdj8Ju+cTJQIqoQCeMVqP 086ZRyvnHu9fsF7V8hLeEyI=
=jyGo
-----END PGP SIGNATURE-----

--
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.

Received on Mon 3 Dec 2007 - 15:49:59 EST
 

Date Posted: Jan 15, 2009 | Last Modified: Jan 15, 2009 | Last Reviewed: Jan 15, 2009

 
bottom

National Security Agency / Central Security Service