This commit is contained in:
John Axel Eriksson 2018-10-17 14:16:17 +00:00 committed by GitHub
commit abaa1336a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,7 @@ void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
if (vsnprintf(buf, sizeof(buf), fmt, args) >= max_chars) { if (vsnprintf(buf, sizeof(buf), fmt, args) >= max_chars) {
strcpy(&buf[sizeof(buf) - sizeof(overflow)], overflow); strcpy(&buf[sizeof(buf) - strlen(overflow) - 1], overflow);
} }
va_end(args); va_end(args);
@ -112,7 +112,7 @@ void pango_printf(cairo_t *cairo, const char *font,
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
if (vsnprintf(buf, sizeof(buf), fmt, args) >= max_chars) { if (vsnprintf(buf, sizeof(buf), fmt, args) >= max_chars) {
strcpy(&buf[sizeof(buf) - sizeof(overflow)], overflow); strcpy(&buf[sizeof(buf) - strlen(overflow) - 1], overflow);
} }
va_end(args); va_end(args);