From 9c5af90faeb872e85cb5db980010b0e6859aea37 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 7 Oct 2014 10:23:02 +0200 Subject: [PATCH] lib/portableproplib/prop_object.c: CID 62703 (argument cannot be negative) --- lib/portableproplib/prop_object.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/portableproplib/prop_object.c b/lib/portableproplib/prop_object.c index 181d3f5b..dfa60fe5 100644 --- a/lib/portableproplib/prop_object.c +++ b/lib/portableproplib/prop_object.c @@ -903,11 +903,17 @@ _prop_object_internalize_map_file(const char *fname) { struct stat sb; struct _prop_object_internalize_mapped_file *mf; - size_t pgsize = (size_t)sysconf(_SC_PAGESIZE); - size_t pgmask = pgsize - 1; + long scps = sysconf(_SC_PAGESIZE); + size_t pgsize, pgmask; bool need_guard = false; int fd; + if (scps == -1) + return NULL; + + pgsize = (size_t)scps; + pgmask = pgsize -1; + mf = _PROP_MALLOC(sizeof(*mf), M_TEMP); if (mf == NULL) return (NULL);