-
Notifications
You must be signed in to change notification settings - Fork 7
/
make-4.4.1-expand.patch
35 lines (31 loc) · 1.13 KB
/
make-4.4.1-expand.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- make-4.4.1-orig/src/expand.c 2023-01-28 18:18:16.000000000 +0300
+++ make-4.4.1/src/expand.c 2024-09-18 09:08:36.590934500 +0300
@@ -234,6 +234,17 @@
return variable_buffer;
}
+ if (length == SIZE_MAX)
+ {
+ /* Don't copy the string if it does not contain "$". */
+ p1 = strchr (string, '$');
+ if (!p1)
+ {
+ o = variable_buffer_output (o, string, strlen (string) + 1);
+ return (variable_buffer + line_offset);
+ }
+ }
+
/* We need a copy of STRING: due to eval, it's possible that it will get
freed as we process it (it might be the value of a variable that's reset
for example). Also having a nil-terminated string is handy. */
@@ -246,7 +257,13 @@
variable output buffer, and skip them. Uninteresting chars end
at the next $ or the end of the input. */
- p1 = strchr (p, '$');
+ if (length == SIZE_MAX)
+ {
+ length = 0;
+ p1 = p + (size_t)(p1 - string);
+ }
+ else
+ p1 = strchr (p, '$');
o = variable_buffer_output (o, p, p1 != 0 ? (size_t) (p1 - p) : strlen (p) + 1);