svn commit: r451623 - in head/net/tcpview: . files

David Chisnall theraven at FreeBSD.org
Tue Oct 10 13:15:42 UTC 2017


On 10 Oct 2017, at 14:05, Cy Schubert <Cy.Schubert at komquats.com> wrote:
> 
>>>> gets(3) called only once in this port; why not simply patch that
>>>> single call properly instead of bringing in a "poor man's" macro?
>>> 
>>> As an example. To open discussion of possibilities.
>> 
>> I don't think that having this (even in some extra-guarded form) is
>> good *general* solution.  Macros are fragile and things can go south
>> when the argument is more just a simple pointer.
> 
> Which is the limitation of this. As I said, it was not perfict.

This version, with no guards, looks quite dangerous.  It’s difficult to see from the context, but if str is a char*, then this will always simply set the first byte to null, without reading anything.  The compilation will succeed, yet the code will behave in an unexpected way.  

David



More information about the svn-ports-all mailing list