Skip to content

Commit c33a285

Browse files
committed
Rise buffer size for getpwnam_r and getgrnam_r
In some cases, with large /etc/group or /etc/passwd files, calls to getgrnam_r (in gid_exists) or getpwnam_r (in uid_exists) leads to errno 34 and fail to start the service. This fix rises the buffer size but it would be better to rise it dynamically depending on return value. See man(3) getgrnam_r.
1 parent b3a678c commit c33a285

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main/gridinit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ static gboolean
667667
uid_exists(const gchar *str, gint32 *id)
668668
{
669669
struct passwd pwd, *p_pwd;
670-
gchar buf[1024];
670+
gchar buf[32768];
671671

672672
if (_str_is_num(str)) {
673673
gint64 i64;
@@ -689,7 +689,7 @@ static gboolean
689689
gid_exists(const gchar *str, gint32 *id)
690690
{
691691
struct group grp, *p_grp;
692-
gchar buf[1024];
692+
gchar buf[32768];
693693

694694
if (_str_is_num(str)) {
695695
gint64 i64;

0 commit comments

Comments
 (0)