8000 Fix bug GH-11246 cli/get_set_process_title · lucasnetau/php-src@6e6b3b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e6b3b3

Browse files
committed
Fix bug phpGH-11246 cli/get_set_process_title
Fail to clobber_error only when the argv is a non-contiguous area Don't increment the end_of_error if a non-contiguous area is encountered in environ
1 parent 4294e8d commit 6e6b3b3

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
. Fixed bug GH-11222 (foreach by-ref may jump over keys during a rehash).
1111
(Bob)
1212

13+
- CLI:
14+
. Fixed bug GH-11246 (cli/get_set_process_title fails
15+
on MacOS). (James Lucas)
16+
1317
- Exif:
1418
. Fixed bug GH-10834 (exif_read_data() cannot read smaller stream wrapper
1519
chunk sizes). (nielsdos)

sapi/cli/ps_title.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,21 @@ char** save_ps_args(int argc, char** argv)
167167
end_of_area = argv[i] + strlen(argv[i]);
168168
}
169169

170+
if (non_contiguous_area != 0)
171+
goto clobber_error;
172+
170173
/*
171174
* check for contiguous environ strings following argv
172175
*/
173176
for (i = 0; (non_contiguous_area == 0) && (environ[i] != NULL); i++)
174177
{
175-
if (end_of_area + 1 != environ[i])
178+
if (end_of_area + 1 != environ[i]) {
176179
non_contiguous_area = 1;
177-
end_of_area = environ[i] + strlen(environ[i]);
180+
} else {
181+
end_of_area = environ[i] + strlen(environ[i]);
182+
}
178183
}
179184

180-
if (non_contiguous_area != 0)
181-
goto clobber_error;
182-
183185
ps_buffer = argv[0];
184186
ps_buffer_size = end_of_area - argv[0];
185187

0 commit comments

Comments
 (0)
0