Re: Type mismatches in safe_read and friends?
- From
- Rogan Dawes <lists@dawes.za.net>
- Date
- Mar 27, 2007, 10:34 UTC
- Message-ID
- <4608F31B.8070204@dawes.za.net>
- In-Reply-To
- <20070326164755.GH13247@spearce.org>
Shawn O. Pearce wrote:
Show 9 quoted lines
> >> Or is it just a case that we don't really care, since we control the >> ranges of the values, and the underlying types are int anyway? Patches >> to follow if I get an indication that anyone cares, otherwise I'd be >> posting my question to a C newbies group. ;-) > > It is sort of a case we don't care. These probably should be fixed. > A patch would be nice. You want to learn C... ;-) >
Ok. So I did a little patch, but I'm not sure whether I solved anything. Now we have an implicit cast from size_t to ssize_t in packet_read_line.
I guess this echoes your comment about requesting a large size_t, and getting a ssize_t result back. I suppose in theory we should be refusing to handle a length greater than that which would fit into a ssize_t? Or simply making sure to always return data smaller than max(ssize_t)?
Patch to follow.
Rogan