batman-adv: check proto length before accessing proto string buffer
PATCH 1/1 batman-adv: check proto length before accessing proto string buffer
batadv_param_set_ra() strips the trailing '\n' from the supplied string buffer without checking the length of the buffer first. This patches avoids random memory access and associated potential crashes.
--- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
main.c +1 -1
@@ -1106,7 +1106,7 @@ static int batadv_param_set_ra(const char *val, const struct kernel_param *kp)char *algo_name = (char *)val;size_t name_len =strlen (algo_name); -if (algo_name[name_len -1 ] =='\n' ) +if (name_len >0 && algo_name[name_len -1 ] =='\n' ) algo_name[name_len -1 ] ='\0' ; bat_algo_ops =batadv_algo_get (algo_name);
Signature · 1 line
1.7.10.4
Quoted 7 lines · Marek Lindner
batadv_param_set_ra()strips the trailing '\n' from the supplied string buffer without checking the length of the buffer first. This patches avoids random memory access and associated potential crashes.Reported-by Sasha Levin <[email protected]>Signed-off-by Marek Lindner <[email protected]>
Thank you for fixing this!
Please, merge this patch in maint.
Cheers,
Signature · 4 lines
Antonio Quartulli ..each of us alone is worth nothing.. Ernesto "Che" Guevara
Marek Lindner
AppliedQuoted 8 lines · On Sunday, April 28, 2013 00:01:32 Antonio Quartulli wrote:
Quoted 7 lines · Marek Lindner
batadv_param_set_ra()strips the trailing '\n' from the supplied string buffer without checking the length of the buffer first. This patches avoids random memory access and associated potential crashes.
Quoted 6 lines
Quoted 2 lines
Reported-by Sasha Levin <[email protected]>Signed-off-by Marek Lindner <[email protected]>Thank you for fixing this!
Please, merge this patch in maint.
Applied in revision aa7d19a.
Regards,
Marek