From abab994411567d51ad001314fa81d81cb70fd8bf Mon Sep 17 00:00:00 2001 From: alvaro <alvaro.felipe91@gmail.com> Date: Tue, 4 Jul 2017 22:48:36 +0200 Subject: [PATCH] Fix NULL deference for no ELF files Fix crash 060833f08dc14d1712428742b3cad7af17b36bb7 --- elfio/elfio.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/elfio/elfio.hpp b/elfio/elfio.hpp index 428d761..d798961 100644 --- a/elfio/elfio.hpp +++ b/elfio/elfio.hpp @@ -148,12 +148,11 @@ class elfio { std::ofstream f( file_name.c_str(), std::ios::out | std::ios::binary ); - if ( !f ) { + if ( !f || !header) { return false; } bool is_still_good = true; - // Define layout specific header fields // The position of the segment table is fixed after the header. // The position of the section table is variable and needs to be fixed -- GitLab