diff --git a/rpmfile/headers.py b/rpmfile/headers.py
index <HASH>..<HASH> 100644
--- a/rpmfile/headers.py
+++ b/rpmfile/headers.py
@@ -148,7 +148,7 @@ def _readheader(fileobj):
     while char != b'\x8e':
         char = fileobj.read(1)
 
-        if char is None:
+        if char is None or char == '':
             raise RPMError("reached end of file without finding magic char \x8e")
 
     magic = b'\x8e' + fileobj.read(2)
Fixed never ending loop

io.read returns either None or '' on reaching the end of the file.