mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user