about summary refs log tree commit diff
path: root/converter/other/fitstopnm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-12-31 00:01:23 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-12-31 00:01:23 +0000
commiteb5b52f36af040404fcff790e36201ba15608ef9 (patch)
tree34180bd9372cf72b5532b5eed4ab1104a6f55c82 /converter/other/fitstopnm.c
parent71331acc9a6ac04ea2370501ea8d1d77de207b71 (diff)
downloadnetpbm-mirror-eb5b52f36af040404fcff790e36201ba15608ef9.tar.gz
netpbm-mirror-eb5b52f36af040404fcff790e36201ba15608ef9.tar.xz
netpbm-mirror-eb5b52f36af040404fcff790e36201ba15608ef9.zip
Release 10.73.42
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@4485 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/fitstopnm.c')
-rw-r--r--converter/other/fitstopnm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/converter/other/fitstopnm.c b/converter/other/fitstopnm.c
index bdf5c78a..e7de4311 100644
--- a/converter/other/fitstopnm.c
+++ b/converter/other/fitstopnm.c
@@ -358,7 +358,7 @@ readCard(FILE * const ifP,
     size_t bytesRead;
 
     bytesRead = fread(buf, 1, 80, ifP);
-    if (bytesRead == 0)
+    if (bytesRead < 80)
         pm_error("error reading header");
 }
 
@@ -380,12 +380,15 @@ readFitsHeader(FILE *               const ifP,
   
     while (!seenEnd) {
         unsigned int i;
+
         for (i = 0; i < 36; ++i) {
-            char buf[80];
+            char buf[81];
             char c;
 
-            readCard(ifP, buf);
+            readCard(ifP, buf); /* Reads into first 80 elements of buf[] */
     
+            buf[80] = '\0'; /* Make ASCIIZ string */
+
             if (sscanf(buf, "SIMPLE = %c", &c) == 1) {
                 if (c == 'T' || c == 't')
                     hP->simple = 1;