summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-04-07 23:26:00 +0000
committerjbj <devnull@localhost>2004-04-07 23:26:00 +0000
commitdc885367f50e2d0669abd6308e1a09bb9aa9ae2d (patch)
tree15a51665574d4af624816905e5061fdec9b13265 /lib
parent84573a3571e268dff5d103b47bf1ecb37127a13a (diff)
downloadlibrpm-tizen-dc885367f50e2d0669abd6308e1a09bb9aa9ae2d.tar.gz
librpm-tizen-dc885367f50e2d0669abd6308e1a09bb9aa9ae2d.tar.bz2
librpm-tizen-dc885367f50e2d0669abd6308e1a09bb9aa9ae2d.zip
- fix: segfault on --recontext if file_contexts unreadable (#117374).
- fix: /etc/security/selinux/file_contexts is default path. CVS patchset: 7220 CVS date: 2004/04/07 23:26:00
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmfi.c3
-rw-r--r--lib/rpmsx.c7
-rw-r--r--lib/rpmsx.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index 70ad7531d..0574c1bd6 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1619,7 +1619,7 @@ void rpmfiBuildREContexts(Header h,
int scareMem = 0;
rpmfi fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, scareMem);
rpmsx sx = NULL;
- const char ** av;
+ const char ** av = NULL;
int ac;
size_t nb;
char * t;
@@ -1628,7 +1628,6 @@ void rpmfiBuildREContexts(Header h,
int * fcnb;
if ((ac = rpmfiFC(fi)) <= 0) {
- av = NULL;
ac = 0;
goto exit;
}
diff --git a/lib/rpmsx.c b/lib/rpmsx.c
index 3da2411a5..846b826cd 100644
--- a/lib/rpmsx.c
+++ b/lib/rpmsx.c
@@ -166,17 +166,18 @@ static int rpmsxAdd(rpmsx sx, const char ** bpp)
* Find the stem of a file name.
* Error iff a file in the root directory or a regex that is too complex.
*
+ * @param sx security context patterns
* @retval *bpp ptr to text after stem.
* @return stem index, -1 on error
*/
-static int rpmsxFind(const rpmsx sx, const char ** bpp)
+static int rpmsxFind(/*@null@*/ const rpmsx sx, const char ** bpp)
/*@modifies *bpp @*/
{
size_t stem_len = rpmsxsFStem(*bpp);
rpmsxs sxs;
int i;
- if (stem_len)
+ if (sx != NULL && stem_len > 0)
for (i = 0; i < sx->nsxs; i++) {
sxs = sx->sxs + i;
if (stem_len != sxs->len)
@@ -327,7 +328,7 @@ int rpmsxParse(rpmsx sx, const char * fn)
/*@-branchstate@*/
if (fn == NULL)
- fn = "/etc/security/selinux/src/policy/file_contexts/file_contexts";
+ fn = "/etc/security/selinux/file_contexts";
/*@=branchstate@*/
if ((fp = fopen(fn, "r")) == NULL) {
diff --git a/lib/rpmsx.h b/lib/rpmsx.h
index a74edf908..65417007f 100644
--- a/lib/rpmsx.h
+++ b/lib/rpmsx.h
@@ -267,7 +267,7 @@ rpmsx rpmsxInit(/*@null@*/ rpmsx sx, int reverse)
* @return file security context
*/
/*@owned@*/ /*@null@*/
-const char * rpmsxFContext(rpmsx sx, const char * fn, mode_t fmode)
+const char * rpmsxFContext(/*@null@*/ rpmsx sx, const char * fn, mode_t fmode)
/*@modifies sx @*/;
#ifdef __cplusplus