Don't print non-printable characters in AX.25 addresses.
Add a new routine to wsutil to make this easy: printable_char_or_period(). Bug: 10439 Change-Id: I0eb2bb6bc0676a1035c3d845b5e20276fa04de60 Reviewed-on: https://code.wireshark.org/review/3981 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
1192606e88
commit
2497482e34
|
@ -54,6 +54,7 @@
|
|||
#include "value_string.h"
|
||||
#include "addr_resolv.h"
|
||||
#include "wsutil/pint.h"
|
||||
#include "wsutil/str_util.h"
|
||||
#include "atalk-utils.h"
|
||||
#include "sna-utils.h"
|
||||
#include "osi-utils.h"
|
||||
|
@ -628,8 +629,12 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
|
|||
case AT_AX25:
|
||||
addrdata = (const guint8 *)addr->data;
|
||||
g_snprintf(buf, buf_len, "%c%c%c%c%c%c-%02d",
|
||||
(addrdata[0] >> 1) & 0x7f, (addrdata[1] >> 1) & 0x7f, (addrdata[2] >> 1) & 0x7f,
|
||||
(addrdata[3] >> 1) & 0x7f, (addrdata[4] >> 1) & 0x7f, (addrdata[5] >> 1) & 0x7f,
|
||||
printable_char_or_period(addrdata[0] >> 1),
|
||||
printable_char_or_period(addrdata[1] >> 1),
|
||||
printable_char_or_period(addrdata[2] >> 1),
|
||||
printable_char_or_period(addrdata[3] >> 1),
|
||||
printable_char_or_period(addrdata[4] >> 1),
|
||||
printable_char_or_period(addrdata[5] >> 1),
|
||||
(addrdata[6] >> 1) & 0x0f );
|
||||
break;
|
||||
case AT_IEEE_802_15_4_SHORT:
|
||||
|
|
|
@ -123,7 +123,9 @@ isdigit_string(guchar *str)
|
|||
#endif
|
||||
|
||||
/* Given a size, return its value in a human-readable format */
|
||||
gchar *format_size(gint64 size, format_size_flags_e flags) {
|
||||
gchar *
|
||||
format_size(gint64 size, format_size_flags_e flags)
|
||||
{
|
||||
GString *human_str = g_string_new("");
|
||||
int power = 1000;
|
||||
int pfx_off = 0;
|
||||
|
@ -178,3 +180,9 @@ gchar *format_size(gint64 size, format_size_flags_e flags) {
|
|||
g_string_free(human_str, FALSE);
|
||||
return g_strchomp(ret_val);
|
||||
}
|
||||
|
||||
gchar
|
||||
printable_char_or_period(gchar c)
|
||||
{
|
||||
return g_ascii_isprint(c) ? c : '.';
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ typedef enum {
|
|||
WS_DLL_PUBLIC
|
||||
gchar *format_size(gint64 size, format_size_flags_e flags);
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
gchar printable_char_or_period(gchar c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue