# [PATCH] Bug fix for #29770, but for PHP 4.3.9

- Thread: https://externals.io/message/13562
- Original archive: https://news-web.php.net/php.internals/13562
- Started by Vladimir Zidar on 2004-10-27T12:14:22+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13562 — Vladimir Zidar — 2004-10-27T12:14:22+00:00

URL: https://externals.io/message/13562#13562

When safe_mode is set to 'on', `popen()` uses char buf[1024] to build argument list. This is not good, as it truncates command line without notice.
 This is NOT operating system limit - as noted on bugreport, but PHP bug.

 If anybody cares, here is fix for this bug under 4.3.9:

 http://leya.mindnever.org/~mr_w/php-popen.patch.gz

 PS, didn't have time to look at PHP 5 yet, but I suppose this fix could
work also with minor tweaks.


-- 
Vladimir Zidar, Programmer

MindNever Foodstuff TRDG.
Head Office Branch

Tel: +381-63-550161, +385-98-9574261
http://www.mindnever.org, icq: 15414204, mail: mr_W@mindnever.org

---

## #13567 — Andi Gutmans — 2004-10-27T16:51:52+00:00

URL: https://externals.io/message/13562#13567 · In reply to: #13562

This patch makes sense to me. Anyone have a problem with it?

Andi

At 02:14 PM 10/27/2004 +0200, Vladimir Zidar wrote:
>  When safe_mode is set to 'on', `popen()` uses char buf[1024] to build 
> argument list. This is not good, as it truncates command line without notice.
>  This is NOT operating system limit - as noted on bugreport, but PHP bug.
>
>  If anybody cares, here is fix for this bug under 4.3.9:
>
>  http://leya.mindnever.org/~mr_w/php-popen.patch.gz
>
>  PS, didn't have time to look at PHP 5 yet, but I suppose this fix could
>work also with minor tweaks.
>
>
>--
>Vladimir Zidar, Programmer
>
>MindNever Foodstuff TRDG.
>Head Office Branch
>
>Tel: +381-63-550161, +385-98-9574261
>http://www.mindnever.org, icq: 15414204, mail: mr_W@mindnever.org

---

## #13570 — Wez Furlong — 2004-10-27T17:23:44+00:00

URL: https://externals.io/message/13562#13570 · In reply to: #13567

I'd feel slightly happier if it used spprintf() instead of manually
calculating the buffer length, but otherwise I'm okay with it.

--Wez.



> This patch makes sense to me. Anyone have a problem with it?
> 
> Andi
> 
> 
> 
> At 02:14 PM 10/27/2004 +0200, Vladimir Zidar wrote:
> > […]

---

## #13572 — Vladimir Zidar — 2004-10-27T17:30:41+00:00

URL: https://externals.io/message/13562#13572 · In reply to: #13570

I didn't know that such function exist. I can change my patch, and
everybody should feel better.. ok ?


> I'd feel slightly happier if it used spprintf() instead of manually
> calculating the buffer length, but otherwise I'm okay with it.
> 
> --Wez.
> 
> 
> 
> > […]
-- 
Vladimir Zidar, Programmer

MindNever Foodstuff TRDG.
Head Office Branch

Tel: +381-63-550161, +385-98-9574261
http://www.mindnever.org, icq: 15414204, mail: mr_W@mindnever.org

---

## #13577 — Vladimir Zidar — 2004-10-27T18:46:18+00:00

URL: https://externals.io/message/13562#13577 · In reply to: #13572

Here is version that uses spprintf()

 http://leya.mindnever.org/~mr_w/php-popen2.patch.gz



>  I didn't know that such function exist. I can change my patch, and
> everybody should feel better.. ok ?
> 
> 
> > […]
