Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] [Patch] Change of behaviour in get_addr_name

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Francisco Alcoba (TS/EEM)" <francisco.alcoba@xxxxxxxxxxxx>
Date: Fri, 11 Feb 2005 09:02:25 +0100
Hi,

I've changed the behaviour of get_addr_name as explained in:

  http://www.ethereal.com/lists/ethereal-dev/200502/msg00118.html

that is:

> - resolve to a name if the address supports it
> - call address_to_str if it does not, but the address is valid
> - return "NONE" if it is AT_NONE

so that it does not crash if called with an AT_NONE as an argument, and
can be used directly even though the address is not solvable to a name.

I've put an internal solve_address_to_name that works as get_addr_name
previously did, and an external get_addr_name_buf that takes an input
and a size.

I have not made get_addr_name_buf call directly to address_to_str_buf, as proposed in the
e-mail above, because the latter does not accept a size as input, so it might end 
up writing in the buffer more characters that it accepts. Changing address_to_str_buf 
to accept a size, which is proposed in a comment in column_utils.c, would imply further 
changes to called functions, unless I use a local buffer and strncpy to it, which somehow 
defeats the purpose.

I've changed conversations_table, hostlist_table and column_utils accordingly.

Regards,

  Francisco

Attachment: get_addr_name.patch
Description: Binary data