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

41 lines
1.4 KiB
Plaintext

$OpenBSD: patch-gpasm_coff_c,v 1.2 2004/01/30 01:01:11 naddy Exp $
--- gpasm/coff.c.orig 2004-01-21 17:17:52.000000000 +1100
+++ gpasm/coff.c 2004-01-25 20:36:30.000000000 +1100
@@ -32,8 +32,8 @@ void
coff_init(void)
{
if (state.objfile != named) {
- strcpy(state.objfilename, state.basefilename);
- strcat(state.objfilename, ".o");
+ strlcpy(state.objfilename, state.basefilename, sizeof(state.objfilename));
+ strlcat(state.objfilename, ".o", sizeof(state.objfilename));
}
if (state.objfile == suppress) {
@@ -403,7 +403,7 @@ coff_add_sym(char *name, int value, int
new = gp_coffgen_findsymbol(state.obj.object, name);
if (new != NULL) {
- sprintf(message,
+ snprintf(message, sizeof(message),
"Duplicate label or redefining symbol that cannot be redefined. (%s)",
name);
gperror(GPE_DUPLAB, message);
@@ -547,14 +547,14 @@ coff_local_name(char *name)
if (local == NULL) {
/* It isn't in the stGlobal so it must be in stTop. It's local. */
while(1) {
- sprintf(buffer, "_%d%s", count, name);
+ snprintf(buffer, sizeof(buffer), "_%d%s", count, name);
symbol = gp_coffgen_findsymbol(state.obj.object, buffer);
if (symbol == NULL)
break;
count++;
}
} else {
- strcpy(buffer, name);
+ strlcpy(buffer, name, sizeof(buffer));
}
return strdup(buffer);