1 |
vapier 10/10/05 00:40:58 |
2 |
|
3 |
Added: gputils-0.13.7-strncat.patch |
4 |
Log: |
5 |
Version bump #275510 by Urriellu. |
6 |
|
7 |
(Portage version: 2.2_rc86/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-embedded/gputils/files/gputils-0.13.7-strncat.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-embedded/gputils/files/gputils-0.13.7-strncat.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-embedded/gputils/files/gputils-0.13.7-strncat.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: gputils-0.13.7-strncat.patch |
16 |
=================================================================== |
17 |
https://sourceforge.net/tracker/?func=detail&aid=3081197&group_id=41924&atid=431665 |
18 |
https://sourceforge.net/tracker/?func=detail&aid=3081206&group_id=41924&atid=431665 |
19 |
|
20 |
--- a/gpasm/scan.c |
21 |
+++ b/gpasm/scan.c |
22 |
@@ -461,9 +461,7 @@ search_pathes(struct source_context *new, char *name) |
23 |
int i; |
24 |
|
25 |
for(i = 0; i < state.path_num; i++) { |
26 |
- strncpy(tryname, state.paths[i], sizeof(tryname)); |
27 |
- strncat(tryname, COPY_CHAR, sizeof(tryname)); |
28 |
- strncat(tryname, name, sizeof(tryname)); |
29 |
+ snprintf(tryname, sizeof(tryname), "%s%s%s", state.paths[i], COPY_CHAR, name); |
30 |
new->f = fopen(tryname, "rt"); |
31 |
if(new->f) { |
32 |
new->name = strdup(tryname); |
33 |
--- a/gplink/gplink.c |
34 |
+++ b/gplink/gplink.c |
35 |
@@ -340,9 +340,7 @@ void gplink_open_coff(char *name) |
36 |
int i; |
37 |
|
38 |
for(i = 0; i < state.numpaths; i++) { |
39 |
- strncpy(file_name, state.paths[i], sizeof(file_name)); |
40 |
- strncat(file_name, COPY_CHAR, sizeof(file_name)); |
41 |
- strncat(file_name, name, sizeof(file_name)); |
42 |
+ snprintf(file_name, sizeof(file_name), "%s%s%s", state.paths[i], COPY_CHAR, name); |
43 |
coff = fopen(file_name, "rb"); |
44 |
if (coff != NULL) { |
45 |
break; |
46 |
@@ -695,9 +693,7 @@ linker(void) |
47 |
gp_error("linker script not specified and can't determine default script"); |
48 |
return EXIT_FAILURE; |
49 |
} |
50 |
- strncpy(file_name, gp_lkr_path, sizeof(file_name)); |
51 |
- strncat(file_name, COPY_CHAR, sizeof(file_name)); |
52 |
- strncat(file_name, script_name, sizeof(file_name)); |
53 |
+ snprintf(file_name, sizeof(file_name), "%s%s%s", gp_lkr_path, COPY_CHAR, script_name); |
54 |
gp_message("using default linker script \"%s\"", file_name); |
55 |
open_src(file_name, 0); |
56 |
yyparse(); |
57 |
--- a/gplink/scan.c |
58 |
+++ b/gplink/scan.c |
59 |
@@ -115,9 +115,7 @@ void open_src(char *name, int isinclude) |
60 |
int i; |
61 |
|
62 |
for(i = 0; i < state.numpaths; i++) { |
63 |
- strncpy(tryname, state.paths[i], sizeof(tryname)); |
64 |
- strncat(tryname, COPY_CHAR, sizeof(tryname)); |
65 |
- strncat(tryname, name, sizeof(tryname)); |
66 |
+ snprintf(tryname, sizeof(tryname), "%s%s%s", state.paths[i], COPY_CHAR, name); |
67 |
new->f = fopen(tryname, "rt"); |
68 |
if(new->f) { |
69 |
new->name = strdup(tryname); |
70 |
--- a/gpasm/lst.c |
71 |
+++ b/gpasm/lst.c |
72 |
@@ -149,22 +149,23 @@ void lst_memory_map(MemBlock *m) |
73 |
} |
74 |
|
75 |
if(row_used) { |
76 |
- snprintf(buf, sizeof(buf), "%08x :", (i + base) << _16bit_core); |
77 |
+ int len = sizeof(buf); |
78 |
+ len -= snprintf(buf, len, "%08x :", (i + base) << _16bit_core); |
79 |
for (j = 0; j < num_per_line; j++) { |
80 |
if ((j % num_per_block) == 0) { |
81 |
- strncat(buf, " ", sizeof(buf)); |
82 |
+ strncat(buf, " ", len--); |
83 |
} |
84 |
if (m->memory[i + j] & MEM_USED_MASK) { |
85 |
- strncat(buf, "X", sizeof(buf)); |
86 |
+ strncat(buf, "X", len--); |
87 |
if (_16bit_core) { |
88 |
/* each word has two bytes */ |
89 |
- strncat(buf, "X", sizeof(buf)); |
90 |
+ strncat(buf, "X", len--); |
91 |
} |
92 |
} else { |
93 |
- strncat(buf, "-", sizeof(buf)); |
94 |
+ strncat(buf, "-", len--); |
95 |
if (_16bit_core) { |
96 |
/* each word has two bytes */ |
97 |
- strncat(buf, "-", sizeof(buf)); |
98 |
+ strncat(buf, "-", len--); |
99 |
} |
100 |
} |
101 |
} |
102 |
@@ -404,7 +405,7 @@ void lst_format_line(char *src_line, int value) |
103 |
} else { |
104 |
snprintf(buf, sizeof(buf), " M "); |
105 |
} |
106 |
- strncat(m, buf, sizeof(m)); |
107 |
+ strncat(m, buf, sizeof(m) - strlen(m)); |
108 |
|
109 |
/* Now copy 'l' to 'e', expanding tabs as required */ |
110 |
{ |