Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 516608
Collapse All | Expand All

(-)a/libselinux/src/label_file.c (+13 lines)
Lines 314-319 static int load_mmap(struct selabel_handle *rec, const char *path, struct stat * Link Here
314
		return -1;
314
		return -1;
315
	addr += sizeof(uint32_t);
315
	addr += sizeof(uint32_t);
316
316
317
	if (*section_len >= SELINUX_COMPILED_FCONTEXT_PCRE_VERS) {
318
		len = strlen(pcre_version());
319
		plen = (uint32_t *)addr;
320
		if (*plen > mmap_area->len)
321
			return -1; /* runs off the end of the map */
322
		if (len != *plen)
323
			return -1; /* pcre version length mismatch */
324
		addr += sizeof(uint32_t);
325
		if (memcmp((char *)addr, pcre_version(), len))
326
			return -1; /* pcre version content mismatch */
327
		addr += *plen;
328
	}
329
317
	/* allocate the stems_data array */
330
	/* allocate the stems_data array */
318
	section_len = (uint32_t *)addr;
331
	section_len = (uint32_t *)addr;
319
	addr += sizeof(uint32_t);
332
	addr += sizeof(uint32_t);
(-)a/libselinux/src/label_file.h (-1 / +3 lines)
Lines 6-12 Link Here
6
#include "label_internal.h"
6
#include "label_internal.h"
7
7
8
#define SELINUX_MAGIC_COMPILED_FCONTEXT	0xf97cff8a
8
#define SELINUX_MAGIC_COMPILED_FCONTEXT	0xf97cff8a
9
#define SELINUX_COMPILED_FCONTEXT_MAX_VERS	1
9
#define SELINUX_COMPILED_FCONTEXT_NOPCRE_VERS	1
10
#define SELINUX_COMPILED_FCONTEXT_PCRE_VERS	2
11
#define SELINUX_COMPILED_FCONTEXT_MAX_VERS	2
10
12
11
/* Prior to verison 8.20, libpcre did not have pcre_free_study() */
13
/* Prior to verison 8.20, libpcre did not have pcre_free_study() */
12
#if (PCRE_MAJOR < 8 || (PCRE_MAJOR == 8 && PCRE_MINOR < 20))
14
#if (PCRE_MAJOR < 8 || (PCRE_MAJOR == 8 && PCRE_MINOR < 20))
(-)a/libselinux/utils/sefcontext_compile.c (-1 / +11 lines)
Lines 127-132 static int process_file(struct saved_data *data, const char *filename) Link Here
127
 *
127
 *
128
 * u32 - magic number
128
 * u32 - magic number
129
 * u32 - version
129
 * u32 - version
130
 * u32 - length of pcre version EXCLUDING nul
131
 * char - pcre version string EXCLUDING nul
130
 * u32 - number of stems
132
 * u32 - number of stems
131
 * ** Stems
133
 * ** Stems
132
 * 	u32  - length of stem EXCLUDING nul
134
 * 	u32  - length of stem EXCLUDING nul
Lines 172-177 static int write_binary_file(struct saved_data *data, int fd) Link Here
172
	if (len != 1)
174
	if (len != 1)
173
		goto err;
175
		goto err;
174
176
177
	/* write the pcre version */
178
	section_len = strlen(pcre_version());
179
	len = fwrite(&section_len, sizeof(uint32_t), 1, bin_file);
180
	if (len != 1)
181
		goto err;
182
	len = fwrite(pcre_version(), sizeof(char), section_len, bin_file);
183
	if (len != section_len)
184
		goto err;
185
175
	/* write the number of stems coming */
186
	/* write the number of stems coming */
176
	section_len = data->num_stems;
187
	section_len = data->num_stems;
177
	len = fwrite(&section_len, sizeof(uint32_t), 1, bin_file);
188
	len = fwrite(&section_len, sizeof(uint32_t), 1, bin_file);
178
- 

Return to bug 516608