#4268 libecl : Add patch for handling of null pointer in util_access

Patch for both Windows and Linux
This commit is contained in:
Magne Sjaastad 2019-04-02 11:19:15 +02:00
parent 262ef57796
commit 38c2097e35
2 changed files with 34 additions and 28 deletions

View File

@ -0,0 +1,34 @@
From ecec875147b3ccf80be619bfa3c45b84ab4202f7 Mon Sep 17 00:00:00 2001
From: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
Date: Tue, 2 Apr 2019 10:11:47 +0200
Subject: [PATCH] guard null pointer
---
ThirdParty/Ert/lib/util/util.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ThirdParty/Ert/lib/util/util.c b/ThirdParty/Ert/lib/util/util.c
index b3eab9822..dfcab323f 100644
--- a/ThirdParty/Ert/lib/util/util.c
+++ b/ThirdParty/Ert/lib/util/util.c
@@ -2153,6 +2153,8 @@ int util_fmove( FILE * stream , long offset , long shift) {
#ifdef HAVE_WINDOWS__ACCESS
bool util_access(const char * entry, int mode) {
+ if (!entry) return false;
+
return (_access(entry, mode) == 0);
}
@@ -2160,6 +2162,8 @@ bool util_access(const char * entry, int mode) {
#ifdef HAVE_POSIX_ACCESS
bool util_access(const char * entry, mode_t mode) {
+ if (!entry) return false;
+
return (access(entry, mode) == 0);
}
#endif
--
2.21.0.windows.1

View File

@ -1,28 +0,0 @@
From 2b1df4bc7dd7a3d622e77d846868faa22caca824 Mon Sep 17 00:00:00 2001
From: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
Date: Mon, 1 Apr 2019 14:26:15 +0200
Subject: [PATCH] #4268 libecl : Check for nullpointer on Windows
---
ThirdParty/Ert/lib/util/util.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ThirdParty/Ert/lib/util/util.c b/ThirdParty/Ert/lib/util/util.c
index 53a0c8584..6243a411f 100644
--- a/ThirdParty/Ert/lib/util/util.c
+++ b/ThirdParty/Ert/lib/util/util.c
@@ -2153,6 +2153,11 @@ int util_fmove( FILE * stream , long offset , long shift) {
#ifdef HAVE_WINDOWS__ACCESS
bool util_access(const char * entry, int mode) {
+ if (!entry)
+ {
+ return false;
+ }
+
return (_access(entry, mode) == 0);
}
--
2.21.0.windows.1