Skip to contentSkip to conversation

uninitialized values in setfiles/psid.c

PATCH In review Colin Walters 2 participants 3 messages Jul 13, 2003 – Jul 15, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uninitialized values in setfiles/psid.c

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.

psid.c renamed from psid.c~ +5 -3
@@ -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) {
#1 lore raw
Quoted 8 lines · Colin Walters

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.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
In reply to Colin Walters
Quoted 8 lines · Colin Walters

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.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.