Using a CodeQL query, I discovered that the destination of a `sscanf` call could overflow.
Thus, we bound the buffer size to be PATH_MAX, to ensure that it is
not larger than `modname` or `devname`.
Signed-off-by: Grayson Nocera <gnocera@purdue.edu>
Suggested-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/260
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
static int do_static_nodes(int argc, char *argv[])
{
struct utsname kernel;
- char modules[PATH_MAX], buf[4096];
+ char modules[PATH_MAX], buf[PATH_MAX];
const char *output = "/dev/stdout";
FILE *in = NULL, *out = NULL;
const struct static_nodes_format *format = &static_nodes_format_human;