From 91509973fe5923a857fdb52ff2859603babe8796 Mon Sep 17 00:00:00 2001 From: Jens Remus Date: Thu, 13 Dec 2018 12:49:38 +0100 Subject: [PATCH] zdev: Do not pass user input as format string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: d54213886815 ("zdev: use libutil provided path functions") Signed-off-by: Jens Remus Reviewed-by: Peter Oberparleiter Signed-off-by: Jan Höppner --- zconf/chp/chchp.c | 2 +- zdev/src/chzdev.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zconf/chp/chchp.c b/zconf/chp/chchp.c index 01ef4554..e71a8c70 100644 --- a/zconf/chp/chchp.c +++ b/zconf/chp/chchp.c @@ -57,7 +57,7 @@ const struct util_prg prg = { { .owner = "IBM Corp.", .pub_first = 2016, - .pub_last = 2017, + .pub_last = 2019, }, UTIL_PRG_COPYRIGHT_END } diff --git a/zdev/src/chzdev.c b/zdev/src/chzdev.c index 7452ad16..4e453335 100644 --- a/zdev/src/chzdev.c +++ b/zdev/src/chzdev.c @@ -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;