shithub: choc

Download patch

ref: e1e4cbd6c355c3e9a50c2203ccabed755dc28a10
parent: ea59eb7140b242bfd3b13b00acb270ecda0ca1de
author: Turo Lamminen <turotl@gmail.com>
date: Tue Jan 9 14:05:39 EST 2018

heretic/p_saveg.c: Error out on incomplete read

--- a/src/heretic/p_saveg.c
+++ b/src/heretic/p_saveg.c
@@ -131,7 +131,12 @@
 
 void SV_Read(void *buffer, int size)
 {
-    fread(buffer, 1, size, SaveGameFP);
+    int retval = fread(buffer, 1, size, SaveGameFP);
+    if (retval != size)
+    {
+        I_Error("Incomplete read in SV_Read: Expected %d, got %d bytes",
+            size, retval);
+    }
 }
 
 byte SV_ReadByte(void)