ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] format_text_wsp() not working?

From: Anders Broman <a.broman58@xxxxxxxxx>
Date: Tue, 15 Nov 2022 16:19:30 +0100
Hi,
Good catch, thanks.
Best regards
Anders

Den tis 15 nov. 2022 kl 15:57 skrev João Valverde <j@xxxxxx>:
This is not going to work as intended:

     rawstr = tvb_format_text(pinfo->pool, tvb, offset, realsize - offset);
     col_add_fstr(pinfo->cinfo, COL_INFO, "Reply: %s",
format_text_wsp(pinfo->pool, rawstr, realsize - offset));

The first call to tvb_format_text() already replaced "\n" with "\\n".
The second call to format_text_wsp() never sees a newline and does nothing.

On 11/15/22 08:41, Anders Broman wrote:
> Hi,
> I encountered strange problem with
>
> https://gitlab.com/wireshark/wireshark/-/merge_requests/8848
> packet 2 of the included trace causes a call to
> col_add_fstr(pinfo->cinfo, COL_INFO, "Reply: %s",
> format_text_wsp(pinfo->pool, rawstr, realsize - offset));
> But it seems like the /n is not replaced with space using the
> debugger. It seems like the call to
> format_text_internal() does not propagate "TRUE" ???
> char *
> format_text_wsp(wmem_allocator_t* allocator, const char *string,
> size_t len)
> {
>     return format_text_internal(allocator, string, len, TRUE);
> }
> Any ideas?
>
> Best regards
> Anders
>
>
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    https://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
>               mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe