shithub: neatpost

Download patch

ref: 3fb3f39df51a9ecc59b7c9c9c84fadc25522164f
parent: f89c755373cff88631fd789a0be8da586b259007
author: Ali Gholami Rudi <ali@rudi.ir>
date: Tue Dec 15 12:36:57 EST 2020

font: prevent glyph name buffer overflow

--- a/font.c
+++ b/font.c
@@ -41,8 +41,8 @@
 		fn->gl = mextend(fn->gl, fn->gl_n, fn->gl_sz, sizeof(fn->gl[0]));
 	}
 	g = &fn->gl[fn->gl_n];
-	strcpy(g->id, id);
-	strcpy(g->name, name);
+	snprintf(g->id, sizeof(g->id), "%s", id);
+	snprintf(g->name, sizeof(g->name), "%s", name);
 	g->type = type;
 	g->font = fn;
 	dict_put(fn->gl_dict, g->id, fn->gl_n);