richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
83a7c7
From d313baf1d3a4756447e398ee55f8c6760f942d50 Mon Sep 17 00:00:00 2001
83a7c7
From: Pavlina Moravcova Varekova <pmoravco@redhat.com>
83a7c7
Date: Wed, 24 Apr 2019 10:29:14 +0200
83a7c7
Subject: [PATCH] Use --dpbath only with full path (RhBug:1696408)
83a7c7
83a7c7
Before the patch rpm treats the relative path as a full path.
83a7c7
The new behavior is similar to the "--root" option.
83a7c7
---
83a7c7
 lib/poptALL.c | 4 ++++
83a7c7
 1 file changed, 4 insertions(+)
83a7c7
83a7c7
diff --git a/lib/poptALL.c b/lib/poptALL.c
83a7c7
index 9983c1e62..69fd49846 100644
83a7c7
--- a/lib/poptALL.c
83a7c7
+++ b/lib/poptALL.c
83a7c7
@@ -147,6 +147,10 @@ static void rpmcliAllArgCallback( poptContext con,
83a7c7
 	break;
83a7c7
     case POPT_DBPATH:
83a7c7
 	rpmcliConfigured();
83a7c7
+	if (arg && arg[0] != '/') {
83a7c7
+	    fprintf(stderr, _("arguments to --dbpath must begin with '/'\n"));
83a7c7
+	    exit(EXIT_FAILURE);
83a7c7
+	}
83a7c7
 	rpmPushMacro(NULL, "_dbpath", NULL, arg, RMIL_CMDLINE);
83a7c7
 	break;
83a7c7
     case POPT_SHOWVERSION:
83a7c7
-- 
83a7c7
2.21.0
83a7c7