diff --git a/lib/display/tran_colr.c b/lib/display/tran_colr.c index 63975f18799..2c416abaecc 100644 --- a/lib/display/tran_colr.c +++ b/lib/display/tran_colr.c @@ -4,10 +4,12 @@ #include -#include #include -#include +#include +#include #include +#include + #include "driver.h" static struct color_rgb *colors; @@ -38,7 +40,9 @@ static int translate_or_add_color(const char *str) char lowerstr[MAX_COLOR_LEN]; /* Make the color string lowercase for display colors */ - strcpy(lowerstr, str); + if (G_strlcpy(lowerstr, str, sizeof(lowerstr)) >= sizeof(lowerstr)) { + G_fatal_error(_("String <%s> is too long"), str); + } G_chop(lowerstr); G_tolcase(lowerstr);