shithub: choc

Download patch

ref: 5bd5e1629b58120d60810bd870faf0107a310834
parent: e1e4cbd6c355c3e9a50c2203ccabed755dc28a10
author: Turo Lamminen <turotl@gmail.com>
date: Tue Jan 9 14:06:13 EST 2018

hexen/sv_save.c: Error out on incomplete read

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