All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] uninitialized values in setfiles/psid.c
@ 2003-07-13  6:20 Colin Walters
  2003-07-14 12:12 ` Stephen Smalley
  2003-07-15 21:06 ` Stephen Smalley
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Walters @ 2003-07-13  6:20 UTC (permalink / raw)
  To: selinux

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

While updating to the newer policycoreutils release, I noticed the
following gcc warnings:

psid.c: In function `chpsid':
psid.c:609: warning: `off' might be used uninitialized in this function
psid.c:610: warning: `len' might be used uninitialized in this function

I believe the patch below should fix the problem.

[-- Attachment #2: setfiles-uninit-value.patch --]
[-- Type: text/plain, Size: 490 bytes --]

--- setfiles/psid.c~	2003-06-02 16:23:07.000000000 -0400
+++ setfiles/psid.c	2003-07-13 02:10:38.000000000 -0400
@@ -658,10 +658,12 @@
 		 */
 		DPRINTF("chpsid:  adding new entry to contexts\n");
 
-		rc = lseek(t->contexts_fp, 0, SEEK_END);
-		if (rc < 0) {
+		len = strlen(context)+1;
+
+		off = lseek(t->contexts_fp, 0, SEEK_END);
+		if (off < 0) {
 			perror("lseek");
-			return rc;
+			return off;
 		}
 		rc = write(t->contexts_fp, context, len);
 		if (rc < 0) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] uninitialized values in setfiles/psid.c
  2003-07-13  6:20 [patch] uninitialized values in setfiles/psid.c Colin Walters
@ 2003-07-14 12:12 ` Stephen Smalley
  2003-07-15 21:06 ` Stephen Smalley
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Smalley @ 2003-07-14 12:12 UTC (permalink / raw)
  To: Colin Walters; +Cc: selinux

On Sun, 2003-07-13 at 02:20, Colin Walters wrote:
> While updating to the newer policycoreutils release, I noticed the
> following gcc warnings:
> 
> psid.c: In function `chpsid':
> psid.c:609: warning: `off' might be used uninitialized in this function
> psid.c:610: warning: `len' might be used uninitialized in this function
> 
> I believe the patch below should fix the problem.

The psid code in setfiles is actually obsolete now, and can be dropped.

-- 
Stephen Smalley <sds@epoch.ncsc.mil>
National Security Agency


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] uninitialized values in setfiles/psid.c
  2003-07-13  6:20 [patch] uninitialized values in setfiles/psid.c Colin Walters
  2003-07-14 12:12 ` Stephen Smalley
@ 2003-07-15 21:06 ` Stephen Smalley
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Smalley @ 2003-07-15 21:06 UTC (permalink / raw)
  To: Colin Walters; +Cc: selinux

On Sun, 2003-07-13 at 02:20, Colin Walters wrote:
> While updating to the newer policycoreutils release, I noticed the
> following gcc warnings:
> 
> psid.c: In function `chpsid':
> psid.c:609: warning: `off' might be used uninitialized in this function
> psid.c:610: warning: `len' might be used uninitialized in this function
> 
> I believe the patch below should fix the problem.

A patch removing the obsolete psid code from setfiles has been committed
to the sourceforge CVS tree.

-- 
Stephen Smalley <sds@epoch.ncsc.mil>
National Security Agency


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-15 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-13  6:20 [patch] uninitialized values in setfiles/psid.c Colin Walters
2003-07-14 12:12 ` Stephen Smalley
2003-07-15 21:06 ` Stephen Smalley

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.