[PATCH] passt-repair: Correct off-by-one error verifying name
passt-repair will generate an error if the name it gets from the kernel is
too long or not NUL terminated. Downstream testing has reported
occasionally seeing this error in practice.
In turns out there is a trivial off-by-one error in the check: ev->len is
the length of the name, including terminating \0 characters, so to check
for a \0 at the end of the buffer we need to check ev->name[len - 1] not
ev->name[len].
Fixes: 42a854a52 ("pasta, passt-repair: Support multiple events per...")
Signed-off-by: David Gibson
On Wed, 2 Apr 2025 15:43:40 +1100
David Gibson
passt-repair will generate an error if the name it gets from the kernel is too long or not NUL terminated. Downstream testing has reported occasionally seeing this error in practice.
In turns out there is a trivial off-by-one error in the check: ev->len is the length of the name, including terminating \0 characters, so to check for a \0 at the end of the buffer we need to check ev->name[len - 1] not ev->name[len].
Ouch, "of course"... :(
Fixes: 42a854a52 ("pasta, passt-repair: Support multiple events per...")
Signed-off-by: David Gibson
Applied. -- Stefano
participants (2)
-
David Gibson
-
Stefano Brivio