zdev: Do not pass user input as format string

The function util_path_exists() consumes its first parameter as format
string. Passing the user input specified to the chzdev option --export
as-is to the function opens up the possibility for a format string
injection.

Fixes: d542138868 ("zdev: use libutil provided path functions")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jens Remus
2018-12-13 12:49:38 +01:00
committed by Jan Höppner
parent 39520546c5
commit 91509973fe
2 changed files with 3 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
*
* chzdev: Configure z Systems specific devices
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -2573,7 +2573,7 @@ static exit_code_t do_export(struct options *opts)
info("Exporting data to standard output\n");
} else {
info("Exporting data to %s\n", opts->export);
if (!util_path_exists(opts->export)) {
if (!util_path_exists("%s", opts->export)) {
rc = path_create(opts->export);
if (rc)
return rc;