106 lines
3.0 KiB
Plaintext
106 lines
3.0 KiB
Plaintext
$OpenBSD: patch-gpal_gpal_c,v 1.2 2004/04/20 12:32:53 avsm Exp $
|
|
--- gpal/gpal.c.orig 2004-01-07 06:35:53.000000000 +0000
|
|
+++ gpal/gpal.c 2004-04-20 13:27:14.000000000 +0100
|
|
@@ -67,10 +67,11 @@ add_file(char *name,
|
|
struct file_struct *file_data;
|
|
|
|
if (extension != NULL) {
|
|
- file_name = malloc(strlen(name) + strlen(extension)+ 2);
|
|
- strcpy(file_name, name);
|
|
- strcat(file_name, ".");
|
|
- strcat(file_name, extension);
|
|
+ size_t len = strlen(name) + strlen(extension) + 2;
|
|
+ file_name = malloc(len);
|
|
+ strlcpy(file_name, name, len);
|
|
+ strlcat(file_name, ".", len);
|
|
+ strlcat(file_name, extension, len);
|
|
} else {
|
|
file_name = strdup(name);
|
|
}
|
|
@@ -389,18 +390,18 @@ assemble(gp_boolean debug_info)
|
|
exit(1);
|
|
}
|
|
|
|
- strcpy(command, "gpasm -c ");
|
|
+ strlcpy(command, "gpasm -c ", sizeof(command));
|
|
|
|
if (debug_info) {
|
|
- strcat(command, "-g ");
|
|
+ strlcat(command, "-g ", sizeof(command));
|
|
}
|
|
|
|
if (gp_quiet) {
|
|
- strcat(command, "-q ");
|
|
+ strlcat(command, "-q ", sizeof(command));
|
|
}
|
|
|
|
- strcat(command, state.basefilename);
|
|
- strcat(command, ".asm ");
|
|
+ strlcat(command, state.basefilename, sizeof(command));
|
|
+ strlcat(command, ".asm ", sizeof(command));
|
|
|
|
if (!gp_debug_disable) {
|
|
printf("%s\n", command);
|
|
@@ -438,38 +439,38 @@ combine_output(void)
|
|
return;
|
|
|
|
if (state.archive == true) {
|
|
- strcpy(command, "gplib -c ");
|
|
+ strlcpy(command, "gplib -c ", sizeof(command));
|
|
} else {
|
|
- strcpy(command, "gplink ");
|
|
+ strlcpy(command, "gplink ", sizeof(command));
|
|
}
|
|
|
|
if (gp_quiet) {
|
|
- strcat(command, "-q ");
|
|
+ strlcat(command, "-q ", sizeof(command));
|
|
}
|
|
|
|
if (state.options) {
|
|
- strcat(command, state.options);
|
|
- strcat(command, " ");
|
|
+ strlcat(command, state.options, sizeof(command));
|
|
+ strlcat(command, " ", sizeof(command));
|
|
}
|
|
|
|
if (state.outfilename == NULL) {
|
|
if (state.archive == true) {
|
|
gp_message("using \"library.a\" for archive name");
|
|
- strcat(command, "library.a ");
|
|
+ strlcat(command, "library.a ", sizeof(command));
|
|
}
|
|
} else {
|
|
if (state.archive == false) {
|
|
- strcat(command, "-o ");
|
|
+ strlcat(command, "-o ", sizeof(command));
|
|
}
|
|
- strcat(command, state.outfilename);
|
|
- strcat(command, " ");
|
|
+ strlcat(command, state.outfilename, sizeof(command));
|
|
+ strlcat(command, " ", sizeof(command));
|
|
}
|
|
|
|
list = state.path;
|
|
while(list) {
|
|
- strcat(command, "-I ");
|
|
- strcat(command, gp_list_get(list));
|
|
- strcat(command, " ");
|
|
+ strlcat(command, "-I ", sizeof(command));
|
|
+ strlcat(command, gp_list_get(list), sizeof(command));
|
|
+ strlcat(command, " ", sizeof(command));
|
|
list = list->next;
|
|
}
|
|
|
|
@@ -477,8 +478,8 @@ combine_output(void)
|
|
while(list) {
|
|
file_data = gp_list_get(list);
|
|
if (file_data->is_link) {
|
|
- strcat(command, file_data->name);
|
|
- strcat(command, " ");
|
|
+ strlcat(command, file_data->name, sizeof(command));
|
|
+ strlcat(command, " ", sizeof(command));
|
|
}
|
|
list = list->next;
|
|
}
|