Project

General

Profile

Review #751

Fix /BIP commands truncating output

Added by Loïc Gomez 20 days ago. Updated 15 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Target version:
Start date:
2022-01-05
Branch:

Description

/BIP list connections and such will truncate output without notifying the user because we use snprintf().
We can use memccpy() instead, in order to respect max line length while not truncating text, and being able to start a new line when required.
https://developers.redhat.com/blog/2019/08/12/efficient-string-copying-and-concatenation-in-c#choosing_a_solution

This will also alleviate work required in #750


Files

memccpy_poc.c (1.26 KB) memccpy_poc.c PoC for bip_strcat_fit() and bip_strcatf_fit() Loïc Gomez, 2022-01-05 17:29
0001-fix-bip-user-info-command.patch (857 Bytes) 0001-fix-bip-user-info-command.patch Fix /BIP user info command Loïc Gomez, 2022-01-10 19:20
0002-Move-BIP-commands-to-bip_strcat-f-_fit-memccpy-wrapp.patch (19.6 KB) 0002-Move-BIP-commands-to-bip_strcat-f-_fit-memccpy-wrapp.patch Do not truncate output Loïc Gomez, 2022-01-10 19:21
0003-sanitize-bip_strcat-f-_fit-cleanup.patch (2.67 KB) 0003-sanitize-bip_strcat-f-_fit-cleanup.patch Better code for previous patch (strict cflags etc.) Loïc Gomez, 2022-01-10 19:21

Related issues

Related to Bip - Enhancement #750: Compile BIP with secure flagsIn Progress2022-01-12

Actions

History

#1

Updated by Loïc Gomez 20 days ago

#2

Updated by Loïc Gomez 20 days ago

Started working on it, see PoC

Also available in: Atom PDF