Package: fig2dev / 1:3.2.7a-5+deb10u1

31_maxcomments.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Tue, 21 Aug 2018 00:28:53 +0200
Subject: Ignore more than MAXCOMMENTS comment lines, ticket #25
Bug-Debian: https://bugs.debian.org/906740
Bug: https://sourceforge.net/p/mcj/tickets/25/
Origin: https://sourceforge.net/p/mcj/fig2dev/ci/0630b3

--- a/fig2dev/read.c
+++ b/fig2dev/read.c
@@ -1481,6 +1481,9 @@ save_comment(void)
 {
     int		    i;
 
+    /* skip too many comment lines */
+    if (numcom == MAXCOMMENTS)
+	return 2;
     i=strlen(buf);
     /* see if we've allocated space for this comment */
     if (comments[numcom])
@@ -1493,8 +1496,7 @@ save_comment(void)
     i=1;
     if (buf[1] == ' ')	/* remove one leading blank from the comment, if there is one */
 	i=2;
-    if (numcom < MAXCOMMENTS)
-	strcpy(comments[numcom++], &buf[i]);
+    strcpy(comments[numcom++], &buf[i]);
     return 1;
 }