aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorErkki Seppälä <erkki.seppala@vincit.fi>2011-01-31 14:02:06 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-12 09:34:38 +0200
commit93615472844ddbf5c530ad911332e5f316aa21b1 (patch)
treef6c8d8d00f93209becc8980e42c779be1791e540 /nx-X11/lib
parent051d521f6e20761ba6831cecd91883da960fa931 (diff)
downloadnx-libs-93615472844ddbf5c530ad911332e5f316aa21b1.tar.gz
nx-libs-93615472844ddbf5c530ad911332e5f316aa21b1.tar.bz2
nx-libs-93615472844ddbf5c530ad911332e5f316aa21b1.zip
Xrm: Handle the extremely unlikely situation of fstat failing
Tracked variable "size" was passed to a negative sink. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> (cherry picked from commit be3e6c205d94dedc1cdebf5d17b987f0f828377a) Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/X11/Xrm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/nx-X11/lib/X11/Xrm.c b/nx-X11/lib/X11/Xrm.c
index d88442c6e..b3d92bb48 100644
--- a/nx-X11/lib/X11/Xrm.c
+++ b/nx-X11/lib/X11/Xrm.c
@@ -1594,6 +1594,12 @@ ReadInFile(_Xconst char *filename)
*/
GetSizeOfFile(fd, size);
+ /* There might have been a problem trying to stat a file */
+ if (size == -1) {
+ close (fd);
+ return (char *)NULL;
+ }
+
if (!(filebuf = Xmalloc(size + 1))) { /* leave room for '\0' */
close(fd);
return (char *)NULL;