Skip to contentSkip to conversation

Fix: Properly sanitize input parameter

PATCH Mathieu Desnoyers 1 participant 1 message Mar 26, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 2 lines · ----- On Mar 26, 2019, at 2:21 PM, Yannick Lamarre [email protected] wrote:

The lttng client uses the sizeof the containing buffer for input string sanitation instead of libc defined macro.

The missing part of this changelog is the "why ?". Why is this change needed ? What is wrong with the code ?

Just describing the code is of limited value. We can get that information from reading the source.

Quoted 5 lines

---
lttng-enable_channel was improperly verifying user input and wrongly rejected valid input.

This part should have been in the changelog, not after "---". Also, we are missing examples of the problems this causes.

Thanks,

Mathieu

Quoted 25 lines

src/bin/lttng/commands/enable_channels.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
src/bin/lttng/commands/enable_channels.c +1 -2
index b4e2942c..5e314d9b 100644
@@ -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;
--

2.11.0

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com