Skip to content

Commit

Permalink
lib/display: Fix Copy Buffer Size issue in tran_colr.c (OSGeo#4851)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhamDesai authored Dec 20, 2024
1 parent 19f6989 commit a989675
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/display/tran_colr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

#include <string.h>

#include <grass/display.h>
#include <grass/colors.h>
#include <grass/raster.h>
#include <grass/display.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include <grass/raster.h>

#include "driver.h"

static struct color_rgb *colors;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit a989675

Please sign in to comment.