teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.5.90-macroarg.patch

Panu Matilainen 469c1c
diff --git a/rpmio/macro.c b/rpmio/macro.c
Panu Matilainen 469c1c
index 14d4565..cc0638a 100644
Panu Matilainen 469c1c
--- a/rpmio/macro.c
Panu Matilainen 469c1c
+++ b/rpmio/macro.c
Panu Matilainen 469c1c
@@ -797,8 +797,10 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
Panu Matilainen 469c1c
     {	ARGV_t av = NULL;
Panu Matilainen 469c1c
 	char *s = xcalloc((lastc-se)+1, sizeof(*s));
Panu Matilainen 469c1c
 
Panu Matilainen 469c1c
-	memmove(s, se, (lastc-se));
Panu Matilainen 469c1c
-	ret = se + strlen(s) + 1;
Panu Matilainen 469c1c
+	/* XXX expandMacro() expects next \0 which can be beyond lastc */
Panu Matilainen 469c1c
+	ret = strchr(se, '\0');
Panu Matilainen 469c1c
+	memcpy(s, se, (lastc-se));
Panu Matilainen 469c1c
+
Panu Matilainen 469c1c
 	argvSplit(&av, s, " ");
Panu Matilainen 469c1c
 	argvAppend(&argv, av);
Panu Matilainen 469c1c