Bug #75696 [Ver->Csd]: posix_getgrnam fails to print details of group
| From: | cmb@php.net | Date: | Sat, 01 Sep 2018 12:32:22 +0000 |
| Subject: | Bug #75696 [Ver->Csd]: posix_getgrnam fails to print details of group | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216840@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75696&edit=1
ID: 75696
Updated by: cmb@php.net
Reported by: jas at eecs dot yorku dot ca
Summary: posix_getgrnam fails to print details of group
-Status: Verified
+Status: Closed
Type: Bug
Package: POSIX related
Operating System: CentOS 7.4
PHP Version: 7.2.0
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2677d438502b68a967d46ffadfadc138070ce762
Log: Fix #75696: posix_getgrnam fails to print details of group
Previous Comments:
------------------------------------------------------------------------
[2018-08-24 16:14:15] cmb@php.net
<https://github.com/php/php-src/pull/3464>
submitted.
------------------------------------------------------------------------
[2018-08-21 15:08:32] cmb@php.net
As requinix already said, what apparently happens is that
sysconf(_SC_GETGR_R_SIZE_MAX) returns a size which is insufficient
(which is allowed by the POSIX spec[1]), and so the following
getgrnam_r() fails with ERANGE[2]. posix_getgrnam() could then
try again with an increased (doubled?) buffer size.
Please try the attached patch (try-again).
[1] <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgrnam.html>
[2] <https://github.com/php/php-src/blob/php-7.3.0beta2/ext/posix/posix.c#L1079-L1090>
------------------------------------------------------------------------
[2018-08-21 15:07:54] cmb@php.net
The following patch has been added/updated:
Patch Name: try-again
Revision: 1534864074
URL: https://bugs.php.net/patch-display.php?bug=75696&patch=try-again&revision=1534864074
------------------------------------------------------------------------
[2018-08-21 14:19:46] jas at eecs dot yorku dot ca
Thanks! Just to confirm - it's therefore a bug in PHP since I can't tell it how much
buffer to allocate for the call, right?
------------------------------------------------------------------------
[2018-08-21 14:16:35] requinix@php.net
34 is ERANGE. Here it means PHP underestimated the amount of space necessary for a buffer to hold
all the information for that group - obviously exhausted by that list of members. It could try again
with a larger buffer.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=75696
--
Edit this bug report at https://bugs.php.net/bug.php?id=75696&edit=1