Lines 1-233
Link Here
|
1 |
diff -ru dmake.orig/rulparse.c rulparse.c |
|
|
2 |
--- dmake.orig/rulparse.c 2009-07-29 13:31:47.000000000 +0100 |
3 |
+++ rulparse.c 2009-07-29 13:32:09.000000000 +0100 |
4 |
@@ -897,7 +897,7 @@ |
5 |
/* Handle %-targets. */ |
6 |
CELLPTR cur; |
7 |
CELLPTR tpq = NIL(CELL); |
8 |
- CELLPTR nprq; |
9 |
+ CELLPTR nprq = NULL; |
10 |
|
11 |
#ifdef DBUG |
12 |
DB_PRINT( "%", ("Handling %%-target [%s : : <prerequisites follow, maybe empty>]", |
13 |
@@ -915,7 +915,8 @@ |
14 |
|
15 |
if( *name == '\'' && name[len-1]=='\'' ){ |
16 |
name[len-1] = '\0'; |
17 |
- strcpy(name,name+1); |
18 |
+ len = strlen(name+1)+1; |
19 |
+ memmove(name,name+1,len); |
20 |
/* add indirect prerequisite */ |
21 |
_add_indirect_prereq( cur ); |
22 |
} |
23 |
diff -ru dmake.orig/dag.c dag.c |
24 |
--- dmake.orig/dag.c 2009-08-07 20:18:31.000000000 +0100 |
25 |
+++ dag.c 2009-08-07 20:30:59.000000000 +0100 |
26 |
@@ -369,14 +369,17 @@ |
27 |
/* strip out any \<nl> combinations where \ is the current |
28 |
* CONTINUATION char */ |
29 |
for(p=q; (p=strchr(p,CONTINUATION_CHAR))!=NIL(char); ) |
30 |
- if( p[1] == '\n' ) |
31 |
- strcpy( p, p+2 ); |
32 |
+ if( p[1] == '\n' ) { |
33 |
+ size_t len = strlen(p+2)+1; |
34 |
+ memmove ( p, p+2, len ); |
35 |
+ } |
36 |
else |
37 |
p++; |
38 |
|
39 |
p = DmStrSpn(q ," \t"); /* Strip white space before ... */ |
40 |
if( p != q ) { |
41 |
- strcpy( q, p); |
42 |
+ size_t len = strlen(p)+1; |
43 |
+ memmove( q, p, len ); |
44 |
p = q; |
45 |
} |
46 |
|
47 |
diff -ru dmake.orig/expand.c expand.c |
48 |
--- dmake.orig/expand.c 2009-08-07 20:18:34.000000000 +0100 |
49 |
+++ expand.c 2009-08-07 20:42:40.000000000 +0100 |
50 |
@@ -230,6 +230,7 @@ |
51 |
char *tok; |
52 |
{ |
53 |
if( strchr( "\"\\vantbrf01234567", tok[1] ) ) { |
54 |
+ size_t len; |
55 |
switch( tok[1] ) { |
56 |
case 'a' : *tok = 0x07; break; |
57 |
case 'b' : *tok = '\b'; break; |
58 |
@@ -246,13 +247,15 @@ |
59 |
register int j = 0; |
60 |
for( ; i<2 && isdigit(tok[2]); i++ ) { |
61 |
j = (j << 3) + (tok[1] - '0'); |
62 |
- strcpy( tok+1, tok+2 ); |
63 |
+ len = strlen(tok+2)+1; |
64 |
+ memmove( tok+1, tok+2, len ); |
65 |
} |
66 |
j = (j << 3) + (tok[1] - '0'); |
67 |
*tok = j; |
68 |
} |
69 |
} |
70 |
- strcpy( tok+1, tok+2 ); |
71 |
+ len = strlen(tok+2)+1; |
72 |
+ memmove( tok+1, tok+2, len ); |
73 |
} |
74 |
} |
75 |
|
76 |
@@ -365,7 +368,8 @@ |
77 |
if( (e = Basename(s)) != s) { |
78 |
if( !(mod & DIRECTORY_FLAG) ) { |
79 |
/* Move the basename to the start. */ |
80 |
- strcpy(s, e); |
81 |
+ size_t len = strlen(e)+1; |
82 |
+ memmove(s, e, len); |
83 |
} |
84 |
else |
85 |
s = e; |
86 |
@@ -382,7 +386,8 @@ |
87 |
|
88 |
if( !(mod & FILE_FLAG) ) { |
89 |
/* Move the suffix to the start. */ |
90 |
- strcpy( s, e ); |
91 |
+ size_t len = strlen(e)+1; |
92 |
+ memmove(s, e, len); |
93 |
} |
94 |
else |
95 |
s = e; |
96 |
@@ -725,8 +730,10 @@ |
97 |
done = !lev; |
98 |
break; |
99 |
} else { |
100 |
+ size_t len; |
101 |
s[1] = ' '; |
102 |
- strcpy( s, s+1 ); |
103 |
+ len = strlen(s+1)+1; |
104 |
+ memmove( s, s+1, len ); |
105 |
} |
106 |
/*FALLTHRU*/ |
107 |
case ' ': |
108 |
@@ -835,8 +842,10 @@ |
109 |
* converted them to a real space. Let's verify this. */ |
110 |
for( p=s; *p && *p != edelim && *p; p++ ) { |
111 |
if( p[0] == '\\' && p[1] == '\n' ) { |
112 |
+ size_t len; |
113 |
p[1] = ' '; |
114 |
- strcpy( p, p+1 ); |
115 |
+ len = strlen(p+1)+1; |
116 |
+ memmove( p, p+1, len ); |
117 |
} |
118 |
} |
119 |
if( !*p ) |
120 |
@@ -1120,7 +1129,10 @@ |
121 |
*flag = 1; |
122 |
res = Expand( start ); |
123 |
|
124 |
- if( (t = DmStrSpn( res, " \t" )) != res ) strcpy( res, t ); |
125 |
+ if( (t = DmStrSpn( res, " \t" )) != res ) { |
126 |
+ size_t len = strlen(t)+1; |
127 |
+ memmove( res, t, len ); |
128 |
+ } |
129 |
} |
130 |
|
131 |
FREE( start ); /* this is ok! start is assigned a DmSubStr above */ |
132 |
diff -ru dmake.orig/getinp.c getinp.c |
133 |
--- dmake.orig/getinp.c 2009-08-07 20:18:31.000000000 +0100 |
134 |
+++ getinp.c 2009-08-07 20:27:08.000000000 +0100 |
135 |
@@ -169,7 +169,8 @@ |
136 |
* text lines on input. The maximum size of this is governened by |
137 |
* Buffer_size */ |
138 |
if( q != p && q[-1] == CONTINUATION_CHAR ) { |
139 |
- strcpy( q, q+1 ); |
140 |
+ size_t len = strlen(q+1)+1; |
141 |
+ memmove( q, q+1, len ); |
142 |
q--; |
143 |
cont = FALSE; |
144 |
} |
145 |
@@ -290,7 +291,8 @@ |
146 |
while( (c = strchr(c, COMMENT_CHAR)) != NIL(char) ) { |
147 |
if( Comment || State == NORMAL_SCAN ) |
148 |
if( c != str && c[-1] == ESCAPE_CHAR ) { |
149 |
- strcpy( c-1, c ); /* copy it left, due to \# */ |
150 |
+ size_t len = strlen(c)+1; |
151 |
+ memmove( c-1, c, len ); /* copy it left, due to \# */ |
152 |
if( pend ) (*pend)--; /* shift tail pointer left */ |
153 |
} |
154 |
else { |
155 |
diff -ru dmake.orig/path.c path.c |
156 |
--- dmake.orig/path.c 2009-08-07 20:18:31.000000000 +0100 |
157 |
+++ path.c 2009-08-07 20:41:30.000000000 +0100 |
158 |
@@ -172,6 +172,7 @@ |
159 |
char *tpath; |
160 |
int hasdriveletter = 0; |
161 |
int delentry; |
162 |
+ size_t len; |
163 |
|
164 |
DB_ENTER( "Clean_path" ); |
165 |
|
166 |
@@ -231,14 +232,16 @@ |
167 |
p++; |
168 |
} |
169 |
while( *p == *DirSepStr); |
170 |
- strcpy(t+1,p); |
171 |
+ len = strlen(p)+1; |
172 |
+ memmove(t+1,p,len); |
173 |
continue; |
174 |
} |
175 |
|
176 |
/* Remove './'. If OOODMAKEMODE is set do this only if it is not at |
177 |
* the start of the path. */ |
178 |
if ( p-q == 1 && *q == '.' && (q != path || !STOBOOL(OOoDmMode)) ) { |
179 |
- strcpy(q,p+1); |
180 |
+ len = strlen(p+1)+1; |
181 |
+ memmove(q,p+1,len); |
182 |
q = tpath; |
183 |
continue; |
184 |
} |
185 |
@@ -268,7 +271,8 @@ |
186 |
} |
187 |
while( *t == *DirSepStr); |
188 |
/* q points to first letter of the current directory/file. */ |
189 |
- strcpy(q,t); |
190 |
+ len = strlen(t)+1; |
191 |
+ memmove(q,t,len); |
192 |
q = tpath; |
193 |
} |
194 |
else |
195 |
--- dmake.orig/make.c 2009-08-08 09:56:10.000000000 +0100 |
196 |
+++ make.c 2009-08-08 10:00:04.000000000 +0100 |
197 |
@@ -1352,8 +1352,10 @@ |
198 |
* Nothing in Expand() should be able to change dynamic macros. */ |
199 |
cmnd = Expand( rp->st_string ); |
200 |
|
201 |
- if( new_attr && (p = DmStrSpn(cmnd," \t\n+-@%")) != cmnd ) |
202 |
- strcpy(cmnd,p); |
203 |
+ if( new_attr && (p = DmStrSpn(cmnd," \t\n+-@%")) != cmnd ) { |
204 |
+ size_t len = strlen(p)+1; |
205 |
+ memmove(cmnd,p,len); |
206 |
+ } |
207 |
|
208 |
/* COMMAND macro is set to "$(CMNDNAME) $(CMNDARGS)" by default, it is |
209 |
* possible for the user to reset it to, for example |
210 |
@@ -1381,8 +1383,10 @@ |
211 |
shell = ((l_attr & A_SHELL) != 0); |
212 |
|
213 |
/* clean up the attributes that we may have just added. */ |
214 |
- if( (p = DmStrSpn(cmnd," \t\n+-@%")) != cmnd ) |
215 |
- strcpy(cmnd,p); |
216 |
+ if( (p = DmStrSpn(cmnd," \t\n+-@%")) != cmnd ) { |
217 |
+ size_t len = strlen(p)+1; |
218 |
+ memmove(cmnd,p,len); |
219 |
+ } |
220 |
} |
221 |
|
222 |
#if defined(MSDOS) |
223 |
@@ -1477,8 +1481,9 @@ |
224 |
for( p=cmnd; *(n = DmStrPbrk(p,tmp)) != '\0'; ) |
225 |
/* Remove the \<nl> sequences. */ |
226 |
if(*n == CONTINUATION_CHAR && n[1] == '\n') { |
227 |
+ size_t len = strlen(n+2)+1; |
228 |
DB_PRINT( "make", ("fixing [%s]", p) ); |
229 |
- strcpy( n, n+2 ); |
230 |
+ memmove( n, n+2, len ); |
231 |
p = n; |
232 |
} |
233 |
/* Look for an escape sequence and replace it by it's corresponding |