Skip to contentSkip to conversation

Fix array out of bound exception

PATCH In review Linus Lüssing 2 participants 2 messages Dec 11, 2009 – Dec 14, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix array out of bound exception

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.

---

functions.c +2 -2
Index: batctl/functions.c
===================================================================
@@ -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:
#1 lore raw

Dear Linus,

thank you for your patch, i have applied it in svn r1496.

Quoted 28 lines · Linus Lüssing

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.

---

Index: batctl/functions.c
===================================================================

functions.c +2 -2
@@ -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
[email protected]
https://lists.open-mesh.net/mm/listinfo/b.a.t.m.a.n