check for valid optarg before using strdup
Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
88254d762d
commit
7608dd74d7
|
@ -495,6 +495,7 @@ static int parseargs(int argc, char *argv[])
|
||||||
setarch(optarg);
|
setarch(optarg);
|
||||||
break;
|
break;
|
||||||
case OP_PRINTFORMAT:
|
case OP_PRINTFORMAT:
|
||||||
|
check_optarg();
|
||||||
config->print_format = strdup(optarg);
|
config->print_format = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
case 'Q': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_QUERY); break;
|
case 'Q': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_QUERY); break;
|
||||||
|
|
Loading…
Reference in New Issue