home · contact · privacy
Make textfile_width() check for too large lines.
[plomrogue] / src / common / readwrite.c
index a0ab3f7cf5ccfef0f7bc7350a5066aa3df13c623..3dcd2a2d90ec307d86a6c23fe99a36048725e143 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "readwrite.h"
 #include <stddef.h> /* size_t */
-#include <stdint.h> /* uint8_t, uint16_t, uint32_t */
+#include <stdint.h> /* uint8_t, uint16_t, uint32_t, UINT32_MAX */
 #include <stdio.h> /* FILE, fseek(), sprintf(), fgets(), fgetc(), ferror(),
                     * fputc(), fwrite(), fclose(), fopen()
                     */
@@ -108,6 +108,7 @@ extern uint32_t textfile_width(FILE * file)
         {
             break;
         }
+        exit_trouble(UINT32_MAX == c_count, f_name, "too large text file line");
         c_count++;
         if ('\n' == c)
         {