diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2016-07-30 20:01:11 -0300 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2016-07-30 20:01:11 -0300 |
commit | 84465bd64be72235bd1184c1b45917f45c96518c (patch) | |
tree | 2d330d5b5e3ec7c98a8200b68a6f533b9badd3e8 | |
parent | 096108b30570dc484fbe824cef05b668f00f7bbc (diff) |
Ensure buffer is large enough while scanning input devices
-rw-r--r-- | modules/devices/inputdevices.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/devices/inputdevices.c b/modules/devices/inputdevices.c index 5bd6c214..d3f8847f 100644 --- a/modules/devices/inputdevices.c +++ b/modules/devices/inputdevices.c @@ -38,9 +38,9 @@ void __scan_input_devices(void) { FILE *dev; - gchar buffer[128]; + gchar buffer[1024]; gchar *tmp, *name = NULL, *phys = NULL; - gint bus = 0, vendor, product, version; + gint bus = 0, vendor = 0, product = 0, version = 0; int d = 0, n = 0; dev = fopen("/proc/bus/input/devices", "r"); @@ -55,7 +55,7 @@ __scan_input_devices(void) input_list = g_strdup(""); input_icons = g_strdup(""); - while (fgets(buffer, 128, dev)) { + while (fgets(buffer, sizeof(buffer), dev)) { tmp = buffer; switch (*tmp) { |