Skip to content

Commit 7325a2b

Browse files
authored
pid1: do not use generated strings as format strings (#19098)
The generated string may include %, which will confuse both the xprintf call, and the VA_FORMAT_ADVANCE macro. Pass the generated string as an argument to a "%s" format string instead.
1 parent 6b1ed5e commit 7325a2b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/core/transaction.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
405405
j->unit->id,
406406
unit_id == array ? "ordering cycle" : "dependency",
407407
*unit_id, *job_type,
408-
unit_ids);
408+
"%s", unit_ids);
409409

410410
if (delete) {
411411
const char *status;
@@ -414,7 +414,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
414414
"MESSAGE=%s: Job %s/%s deleted to break ordering cycle starting with %s/%s",
415415
j->unit->id, delete->unit->id, job_type_to_string(delete->type),
416416
j->unit->id, job_type_to_string(j->type),
417-
unit_ids);
417+
"%s", unit_ids);
418418

419419
if (log_get_show_color())
420420
status = ANSI_HIGHLIGHT_RED " SKIP " ANSI_NORMAL;
@@ -432,7 +432,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
432432
log_struct(LOG_ERR,
433433
"MESSAGE=%s: Unable to break cycle starting with %s/%s",
434434
j->unit->id, j->unit->id, job_type_to_string(j->type),
435-
unit_ids);
435+
"%s", unit_ids);
436436

437437
return sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC,
438438
"Transaction order is cyclic. See system logs for details.");

0 commit comments

Comments
 (0)