bug-coreutils
[Top][All Lists]
Advanced

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

Re: address@hidden: ls --translators (coreutils)]


From: Roland McGrath
Subject: Re: address@hidden: ls --translators (coreutils)]
Date: Fri, 19 Sep 2003 05:50:22 -0400 (EDT)

> Alfred M. Szmidt wrote:
> >    > +          if (trans_stat.st_mode & S_IPTRANS)
> >    > +            {
> >    > +              char buf[1024], *trans = buf;
> >    Is this 1024-byte buffer guaranteed to be large enough?

Code like this is using a mig stub feature whereby a larger buffer is
allocated (as if by mmap) and TRANS pointed there if 1024 is not enough.

There is no limit in the protocol, though the ext2fs and ufs
implementations limit it to one filesystem block (4kb usually now).
Clients should not presume any arbitrary limit on the size of the
translator setting.

The posted code has no arbitrary limit, but leaks.
It needs to do if (trans != buf) munmap(trans, trans_len).
Also, size_t is the proper type for TRANS_LEN.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]