Skip to content

Commit 45c92b1

Browse files
committed
font-edit: Fix potential overflow
'snprintf' output between 2 and 11 bytes into a destination of size 10.
1 parent a1ba2eb commit 45c92b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/font-edit/twin-fedit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static void draw_char(char_t *c)
319319

320320
for (cmd = c->cmd, i = 0; cmd; cmd = cmd->next, i++) {
321321
double tx, ty;
322-
char buf[10];
322+
char buf[11];
323323

324324
if (cmd->op == op_curve) {
325325
tx = cmd->pt[2].x;
@@ -338,7 +338,7 @@ static void draw_char(char_t *c)
338338
cairo_set_source_rgb(cr, 0, .5, .5);
339339

340340
cairo_move_to(cr, tx - 2, ty + 3);
341-
snprintf(buf, sizeof(buf) + 1, "%d", i);
341+
snprintf(buf, sizeof(buf), "%d", i);
342342
cairo_show_text(cr, buf);
343343
cairo_restore(cr);
344344
}

0 commit comments

Comments
 (0)