commit 5f22009dba73922e98d49c0096cece8b215cd45b Author: Thomas Loimer Date: Tue Apr 8 21:34:23 2025 +0200 Permit \0 in the second line in the fig file, #191 diff --git fig2dev/read.c fig2dev/read.c index 0ec958d..2ea18ef 100644 --- fig2dev/read.c +++ fig2dev/read.c @@ -190,7 +190,8 @@ read_objects(FILE *fp, F_compound *obj) } /* check for embedded '\0' */ - if (strlen(buf) < sizeof buf - 1 && buf[strlen(buf) - 1] != '\n') { + if (*buf == '\0' || (strlen(buf) < sizeof buf - 1 && + buf[strlen(buf) - 1] != '\n')) { put_msg("ASCII NUL ('\\0') character within the first line."); exit(EXIT_FAILURE); /* seek to the end of the first line @@ -239,7 +240,7 @@ read_objects(FILE *fp, F_compound *obj) the encoding given in the file */ if (!input_encoding && !strcmp(buf, "encoding: UTF-8\n")) { input_encoding = "UTF-8"; - } else if (buf[strlen(buf) - 1] != '\n') { + } else if (*buf == '\0' || buf[strlen(buf) - 1] != '\n') { /* seek forward to the end of the line; comments here are not mentioned by the specification, thus ignore this comment */