T.30: Fix UTF-8 encoding

Fixes #18649.
This commit is contained in:
João Valverde 2022-11-18 00:42:59 +00:00 committed by AndersBroman
parent 709d65883f
commit 6bc87f01da
1 changed files with 6 additions and 7 deletions

View File

@ -17,6 +17,7 @@
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/charsets.h>
#include "packet-t38.h"
#include "packet-t30.h"
@ -494,22 +495,21 @@ reverse_byte(guint8 val)
static gchar *
t30_get_string_numbers(wmem_allocator_t *pool, tvbuff_t *tvb, int offset, int len)
{
gchar *buf;
gchar buf[LENGTH_T30_NUM+1];
int i;
/* the length must be 20 bytes per T30 rec*/
if (len != LENGTH_T30_NUM)
return NULL;
buf=(gchar *)wmem_alloc(pool, LENGTH_T30_NUM+1);
for (i=0; i<LENGTH_T30_NUM; i++)
buf[LENGTH_T30_NUM-i-1] = reverse_byte(tvb_get_guint8(tvb, offset+i));
/* add end of string */
buf[LENGTH_T30_NUM] = '\0';
return g_strstrip(buf);
char *s = g_strstrip(buf);
return get_utf_8_string(pool, s, (int)strlen(s));
}
@ -520,10 +520,9 @@ dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot
str_num = t30_get_string_numbers(pinfo->pool, tvb, offset, len);
if (str_num) {
proto_tree_add_string_format_value(tree, hf_t30_fif_number, tvb, offset, LENGTH_T30_NUM, str_num,
"%s", str_num);
proto_tree_add_string(tree, hf_t30_fif_number, tvb, offset, LENGTH_T30_NUM, str_num);
col_append_fstr(pinfo->cinfo, COL_INFO, " - Number:%s", str_num );
col_append_fstr(pinfo->cinfo, COL_INFO, " - Number:%s", str_num);
if (t38)
snprintf(t38->desc, MAX_T38_DESC, "Num: %s", str_num);