Fix segfault on %{?getncpus}, regression in 4.19.x

Commit deaebd0c89 assumed there would
always be args, but in the macro existence test none are set up.

Reported as a side-issue in https://issues.redhat.com/browse/RHEL-16557
This commit is contained in:
Panu Matilainen 2023-11-16 11:19:14 +02:00
parent 01fb42d42c
commit c110ad11c3
1 changed files with 1 additions and 1 deletions

View File

@ -1219,7 +1219,7 @@ static unsigned long getmem_proc(int thread)
static void doGetncpus(rpmMacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parsed)
{
const char *sizemacro = NULL;
const char *arg = argv[1] ? argv[1] : "total";
const char *arg = (argv && argv[1]) ? argv[1] : "total";
char buf[32];
unsigned int ncpus = getncpus();
unsigned long mem = 0;