sprintf → snprintf for graphics-only cases too

This commit is contained in:
Juhani Krekelä 2021-11-16 03:41:01 +02:00
parent 7a701b1ae5
commit bc82e4023a
1 changed files with 3 additions and 3 deletions

View File

@ -620,7 +620,7 @@ static struct table *parse_table(unsigned char *html, unsigned char *eof, unsign
mem_free(a);
}
#ifdef G
sprintf(cast_char cell->bgcolor_str, "#%02x%02x%02x", cell->bgcolor.r & 0xff, cell->bgcolor.g & 0xff, cell->bgcolor.b & 0xff);
snprintf(cast_char cell->bgcolor_str, sizeof(cell->bgcolor_str), "#%02x%02x%02x", cell->bgcolor.r & 0xff, cell->bgcolor.g & 0xff, cell->bgcolor.b & 0xff);
#endif
if ((csp = get_num(t_attr, cast_uchar "colspan")) == -1) csp = 1;
if (!csp) csp = -1;
@ -1805,8 +1805,8 @@ void table_bg(struct text_attrib *ta, unsigned char bgstr[8])
if (ta->fg.g > max) max = ta->fg.g;
if (ta->fg.b > max) max = ta->fg.b;
max &= 0xff;
sprintf(cast_char bgstr, "#%02x%02x%02x", max, max, max);
} else sprintf(cast_char bgstr, "#%02x%02x%02x", G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR);
snprintf(cast_char bgstr, 8, "#%02x%02x%02x", max, max, max);
} else snprintf(cast_char bgstr, 8, "#%02x%02x%02x", G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR);
}
static void g_new_tag(struct table *t, unsigned char *name, int x, int y)