shithub: neatroff

Download patch

ref: 37c983e7dd7d4f9a908ab206eb54866026e1042c
parent: b5a08aea2bb8cffd37c2db3009ff54ca7dae0536
author: Ali Gholami Rudi <[email protected]>
date: Wed Aug 17 12:42:12 EDT 2022

font: fix maximum field width in scanf %s specifier

--- a/font.c
+++ b/font.c
@@ -472,13 +472,13 @@
 	struct grule *rule;
 	int feat, scrp, lang;
 	int i, n;
-	if (fscanf(fin, "%128s %d", tok, &n) != 2)
+	if (fscanf(fin, "%127s %d", tok, &n) != 2)
 		return 1;
 	font_readfeat(fn, tok, &feat, &scrp, &lang);
 	rule = font_gsub(fn, n, feat, scrp, lang);
 	rule->sec = fn->secs;
 	for (i = 0; i < n; i++) {
-		if (fscanf(fin, "%128s", tok) != 1)
+		if (fscanf(fin, "%127s", tok) != 1)
 			return 1;
 		if (tok[0] == '-')
 			rule->pats[i].flg = GF_PAT;
@@ -499,13 +499,13 @@
 	struct grule *rule;
 	int feat, scrp, lang;
 	int i, n;
-	if (fscanf(fin, "%128s %d", tok, &n) != 2)
+	if (fscanf(fin, "%127s %d", tok, &n) != 2)
 		return 1;
 	font_readfeat(fn, tok, &feat, &scrp, &lang);
 	rule = font_gpos(fn, n, feat, scrp, lang);
 	rule->sec = fn->secs;
 	for (i = 0; i < n; i++) {
-		if (fscanf(fin, "%128s", tok) != 1)
+		if (fscanf(fin, "%127s", tok) != 1)
 			return 1;
 		col = strchr(tok, ':');
 		if (col)