Re: [gtk-list] still a bug with getpwuid_r [was: Re: 1.1.14 and a lot of core dumps]



Hi, Trog 

> It now looks like this in the CVS:
> 
>  guint bufsize = 64;
> 
> I'm not convinced that this is correct. The buffer should be big
> enough to hold the largest entry in /etc/passwd.
> 
> The Digital Unix man page states:
> 
> [Digital]  The minimum buffer size is 1024 bytes as defined for
>             SIABUFSIZ in /usr/include/sia.h.
> 
> As 64 < 1024 we appear to have a problem.

No, the buffer size is doubled, until the buffer is big enough, allocating
to much buffer right away is not a good idea, I think. 64 should actually
be enough for most uses. (i.e. is must hold the name, real name and home
dir of the user, typical sizes might be 8, 25, 25 thus the sum is 61
(including the \0 at the end) so it looks as if it should suffice in most
situations.)

Bye,
Sebastian

-- 
Sebastian Wilhelmi                   |            här ovanför alla molnen
mailto:wilhelmi@ira.uka.de           |      är himmlen så förunerligt blå
http://goethe.ira.uka.de/~wilhelmi   |



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]