Fix: Properly sanitize input parameter
A message that is not in the archive (sent off-list or not yet received): [email protected]
Merged in master, stable-2.11, stable-2.10, and stable-2.9.
Thanks!
Jérémie
Quoted 30 lines · Yannick Lamarre
The lttng client uses the sizeof the containing buffer, defined as
LTTNG_SYMBOL_NAME_LEN, for input string sanitation instead of libc defined macroNAME_MAX. lttng-enable_channel improperly verified user input and wrongly discarded valid input in caseNAME_MAXwas less than the sizeof the containing buffer for the channel's name.
This patch also fixes potential buffer overflow caused by an improperly bounded strcpy in the case whereNAME_MAXwould have been greater thanLTTNG_SYMBOL_NAME_LEN.Signed-off-by Yannick Lamarre <[email protected]>--- src/bin/lttng/commands/enable_channels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/bin/lttng/commands/enable_channels.c +1
-1@@ -244,7 +244,7 @@ static int enable_channel(char *session_name)void *extended_ptr;/* Validate channel name's length */ -if (strlen (channel_name) >=NAME_MAX ) { +if (strlen (channel_name) >sizeof (chan_opts.name) -1 ) {ERR ("Channel name is too long (max. %zu characters)" ,sizeof (chan_opts.name) -1 ); error =1 ;Signature · 1 line
2.11.0