Date: Wed, 11 Sep 2019 10:28:33 +0200 From: Sebastian Huber <sebastian.huber@embedded-brains.de> To: freebsd-hackers@freebsd.org Subject: [PATCH] nvmecontrol: Fix shortopts allocation Message-ID: <20190911082833.32388-1-sebastian.huber@embedded-brains.de>
next in thread | raw e-mail | index | archive | help
Account for potential ':' in the short options string. --- sbin/nvmecontrol/comnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/comnd.c b/sbin/nvmecontrol/comnd.c index d8d97ad11b5..a91969ff766 100644 --- a/sbin/nvmecontrol/comnd.c +++ b/sbin/nvmecontrol/comnd.c @@ -189,7 +189,7 @@ arg_parse(int argc, char * const * argv, const struct cmd *f) lopts = malloc((n + 2) * sizeof(struct option)); if (lopts == NULL) err(1, "option memory"); - p = shortopts = malloc((n + 3) * sizeof(char)); + p = shortopts = malloc((2 * n + 2) * sizeof(char)); if (shortopts == NULL) err(1, "shortopts memory"); idx = 0; -- 2.16.4
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190911082833.32388-1-sebastian.huber>