- Return error on invalid file

This commit is contained in:
Daniel J Walsh 2009-04-17 15:25:00 +00:00
parent 9b8c9f0229
commit 713ea522a4
2 changed files with 65 additions and 5 deletions

View File

@ -1,6 +1,63 @@
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage-2.0.31/src/direct_api.c
--- nsalibsemanage/src/direct_api.c 2009-01-13 08:45:35.000000000 -0500
+++ libsemanage-2.0.31/src/direct_api.c 2009-04-09 11:49:42.000000000 -0400
@@ -991,7 +991,7 @@
int retval = -1;
char *data = NULL;
- size_t data_len = 0;
+ ssize_t data_len = 0;
int compressed = 0;
int in_fd = -1;
@@ -999,7 +999,7 @@
return -1;
}
- if ((data_len = map_file(in_fd, &data, &compressed)) == 0) {
+ if ((data_len = map_file(in_fd, &data, &compressed)) <= 0) {
goto cleanup;
}
@@ -1117,7 +1117,7 @@
{
int retval = -1;
char *data = NULL;
- size_t data_len = 0;
+ ssize_t data_len = 0;
int compressed = 0;
int in_fd = -1;
@@ -1125,7 +1125,7 @@
return -1;
}
- if ((data_len = map_file(in_fd, &data, &compressed)) == 0) {
+ if ((data_len = map_file(in_fd, &data, &compressed)) <= 0) {
goto cleanup;
}
@@ -1187,7 +1187,7 @@
{
int retval = -1;
char *data = NULL;
- size_t data_len = 0;
+ ssize_t data_len = 0;
int compressed = 0;
int in_fd;
@@ -1195,7 +1195,7 @@
return -1;
}
- if ((data_len = map_file(in_fd, &data, &compressed)) == 0) {
+ if ((data_len = map_file(in_fd, &data, &compressed)) <= 0) {
goto cleanup;
}
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libsemanage-2.0.31/src/genhomedircon.c
--- nsalibsemanage/src/genhomedircon.c 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.31/src/genhomedircon.c 2009-03-11 15:36:08.000000000 -0400
+++ libsemanage-2.0.31/src/genhomedircon.c 2009-03-26 14:55:01.000000000 -0400
@@ -794,6 +794,12 @@
* /root */
continue;
@ -16,7 +73,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libseman
*errors = STATUS_ERR;
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/handle.c libsemanage-2.0.31/src/handle.c
--- nsalibsemanage/src/handle.c 2008-11-14 17:10:15.000000000 -0500
+++ libsemanage-2.0.31/src/handle.c 2009-03-11 15:36:26.000000000 -0400
+++ libsemanage-2.0.31/src/handle.c 2009-03-26 14:55:01.000000000 -0400
@@ -264,7 +264,7 @@
assert(sh != NULL && sh->funcs != NULL && sh->funcs->commit != NULL);
if (!sh->is_in_transaction) {
@ -28,7 +85,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/handle.c libsemanage-2.0
retval = sh->funcs->commit(sh);
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage.conf libsemanage-2.0.31/src/semanage.conf
--- nsalibsemanage/src/semanage.conf 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.31/src/semanage.conf 2009-03-11 15:36:08.000000000 -0400
+++ libsemanage-2.0.31/src/semanage.conf 2009-03-26 14:55:01.000000000 -0400
@@ -35,4 +35,4 @@
# given in <sepol/policydb.h>. Change this setting if a different
# version is necessary.
@ -37,7 +94,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage.conf libsemanag
+expand-check=0
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsemanage-2.0.31/src/semanage_store.c
--- nsalibsemanage/src/semanage_store.c 2009-01-13 08:45:35.000000000 -0500
+++ libsemanage-2.0.31/src/semanage_store.c 2009-03-11 15:36:08.000000000 -0400
+++ libsemanage-2.0.31/src/semanage_store.c 2009-03-26 14:55:01.000000000 -0400
@@ -440,8 +440,6 @@
char tmp[PATH_MAX];
char buf[4192];

View File

@ -3,7 +3,7 @@
Summary: SELinux binary policy manipulation library
Name: libsemanage
Version: 2.0.31
Release: 4%{?dist}
Release: 5%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: http://www.nsa.gov/selinux/archives/libsemanage-%{version}.tgz
@ -91,6 +91,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/python*/site-packages/*
%changelog
* Thu Apr 9 2009 Dan Walsh <dwalsh@redhat.com> - 2.0.31-5
- Return error on invalid file
* Wed Mar 11 2009 Dan Walsh <dwalsh@redhat.com> - 2.0.31-4
- Fix typo