openbsd-ports/devel/gputils/patches/patch-libgputils_gpcofflink_c

35 lines
1.5 KiB
Plaintext

$OpenBSD: patch-libgputils_gpcofflink_c,v 1.2 2004/01/30 01:01:11 naddy Exp $
--- libgputils/gpcofflink.c.orig 2004-01-17 13:33:51.000000000 +1100
+++ libgputils/gpcofflink.c 2004-01-25 20:36:31.000000000 +1100
@@ -415,8 +415,8 @@ _create_rom_section(gp_object_type *obje
int last;
/* create the new section */
- strcpy(name, section->name);
- strcat(name, "_i");
+ strlcpy(name, section->name, sizeof(name));
+ strlcat(name, "_i", sizeof(name));
new = gp_coffgen_newsection(name);
/* select "retlw" instruction */
@@ -547,8 +547,8 @@ gp_add_cinit_section(gp_object_type *obj
while (section != NULL) {
if (section->flags & STYP_DATA) {
/* locate the rom table */
- strcpy(prog_name, section->name);
- strcat(prog_name, "_i");
+ strlcpy(prog_name, section->name, sizeof(prog_name));
+ strlcat(prog_name, "_i", sizeof(prog_name));
prog_section = gp_coffgen_findsection(object,
object->sections,
prog_name);
@@ -1049,7 +1049,7 @@ gp_cofflink_fill_pages(gp_object_type *o
&current_address,
&current_size);
if (found == 1) {
- sprintf(fill_name, ".fill_%i", fill_number++);
+ snprintf(fill_name, sizeof(fill_name), ".fill_%i", fill_number++);
gp_debug(" new section \"%s\" at %#x with size %#x and data %#x",
fill_name,
current_address,