[1/2] batctl: change PATH_BUFF_LEN to maximal possible value

Message ID 20170613082600.24910-2-philipp.psurek@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Simon Wunderlich
Headers
Series [1/2] batctl: change PATH_BUFF_LEN to maximal possible value |

Commit Message

Philipp Psurek June 13, 2017, 8:25 a.m. UTC
  The output of

snprintf(path_buff, PATH_BUFF_LEN, SYS_ROUTING_ALGO_FMT, iface_dir->d_name)

in sys.c can be between 34 and 289 bytes and should not write into a
destination of size 200.

Signed-off-by: Philipp Psurek <philipp.psurek@gmail.com>
---
 functions.c | 2 +-
 functions.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Simon Wunderlich June 13, 2017, 8:49 a.m. UTC | #1
On Tuesday, June 13, 2017 10:25:59 AM CEST Philipp Psurek wrote:
> The output of
> 
> snprintf(path_buff, PATH_BUFF_LEN, SYS_ROUTING_ALGO_FMT, iface_dir->d_name)
> 
> in sys.c can be between 34 and 289 bytes and should not write into a
> destination of size 200.
> 
> Signed-off-by: Philipp Psurek <philipp.psurek@gmail.com>

I've picked this one, but increased the size to 400 to be a bit more future 
proof. :)

Thanks,
      Simon
  

Patch

diff --git a/functions.c b/functions.c
index 2239440..8337ee8 100644
--- a/functions.c
+++ b/functions.c
@@ -59,7 +59,7 @@ 
 #include "debugfs.h"
 #include "netlink.h"
 
-#define PATH_BUFF_LEN 200
+#define PATH_BUFF_LEN 289
 
 static struct timespec start_time;
 static char *host_name;
diff --git a/functions.h b/functions.h
index eca1406..c0a02a8 100644
--- a/functions.h
+++ b/functions.h
@@ -31,7 +31,7 @@ 
 #define ETH_STR_LEN 17
 #define BATMAN_ADV_TAG "batman-adv:"
 
-#define PATH_BUFF_LEN 200
+#define PATH_BUFF_LEN 289
 
 /* return time delta from start to end in milliseconds */
 void start_timer(void);