From c0c491486e6dc6112ffaa2eefacd0a324219b475 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 18 Dec 2016 06:04:34 -0800 Subject: overlay: fix bug with extraordinarily long argvs This was a known bug, there's a TODO sitting right there noting it. The items array was sized very large so it never triggered and was forgotten about. Running `make tags` in the linux kernel source steps on it though, because it constructs a massive argv. This just adds a bounds check so no crash occurs in argv2xtext(). I don't see the point of allocating memory for this as the TODO's suggested, since any such argv is unlikely to fit in the overlay anyways. Also shrunk the max from 1024 to 512, which is still quite large. --- src/vwm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/vwm.h') diff --git a/src/vwm.h b/src/vwm.h index 8bc0f7a..b7a975c 100644 --- a/src/vwm.h +++ b/src/vwm.h @@ -39,6 +39,7 @@ #define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b)) #define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) +#define NELEMS(_a) (sizeof(_a) / sizeof(_a[0])) typedef struct _vwm_window_t vwm_window_t; typedef struct _vwm_desktop_t vwm_desktop_t; -- cgit v1.2.3