[batctl] Fix array out of bound exception
Commit Message
This patch fixes an array out of bound exception in line 201 of
functions.c. We need to reserve one extra character for the
appended null character.
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
Comments
Dear Linus,
thank you for your patch, i have applied it in svn r1496.
On Fri, Dec 11, 2009 at 10:06:23PM +0100, Linus Lüssing wrote:
> This patch fixes an array out of bound exception in line 201 of
> functions.c. We need to reserve one extra character for the
> appended null character.
>
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---
>
> Index: batctl/functions.c
> ===================================================================
> --- batctl/functions.c (revision 1491)
> +++ batctl/functions.c (working copy)
> @@ -161,10 +161,10 @@
>
> if (read_opt & USE_READ_BUFF) {
> read_ptr = read_buff;
> - read_len = sizeof(read_buff);
> + read_len = sizeof(read_buff)-1;
> } else {
> read_ptr = lbuff;
> - read_len = sizeof(lbuff);
> + read_len = sizeof(lbuff)-1;
> }
>
> open:
> _______________________________________________
> B.A.T.M.A.N mailing list
> B.A.T.M.A.N@lists.open-mesh.net
> https://lists.open-mesh.net/mm/listinfo/b.a.t.m.a.n
===================================================================
@@ -161,10 +161,10 @@
if (read_opt & USE_READ_BUFF) {
read_ptr = read_buff;
- read_len = sizeof(read_buff);
+ read_len = sizeof(read_buff)-1;
} else {
read_ptr = lbuff;
- read_len = sizeof(lbuff);
+ read_len = sizeof(lbuff)-1;
}
open: