summaryrefslogtreecommitdiff
path: root/rpmio/macro.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-07-16 09:40:10 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-07-16 09:40:10 +0300
commitf366011c42e4cf13d3acdd1af45127f0a1baec3a (patch)
tree82a5da2711020eedf6898861f506d8d8982097c4 /rpmio/macro.c
parente9cae5eecfab5694be7dddc3fde75f1669e6c240 (diff)
downloadlibrpm-tizen-f366011c42e4cf13d3acdd1af45127f0a1baec3a.tar.gz
librpm-tizen-f366011c42e4cf13d3acdd1af45127f0a1baec3a.tar.bz2
librpm-tizen-f366011c42e4cf13d3acdd1af45127f0a1baec3a.zip
Macro argument handling regression (rhbz#455333)
- expandMacro() wants the next \0 character to be returned, which might or might not be the same as lastc passed to grabArgs() - use memcpy() instead of memmove() for the copy, the areas can't overlap
Diffstat (limited to 'rpmio/macro.c')
-rw-r--r--rpmio/macro.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/rpmio/macro.c b/rpmio/macro.c
index 14d456596..cc0638a4a 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -797,8 +797,10 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
{ ARGV_t av = NULL;
char *s = xcalloc((lastc-se)+1, sizeof(*s));
- memmove(s, se, (lastc-se));
- ret = se + strlen(s) + 1;
+ /* XXX expandMacro() expects next \0 which can be beyond lastc */
+ ret = strchr(se, '\0');
+ memcpy(s, se, (lastc-se));
+
argvSplit(&av, s, " ");
argvAppend(&argv, av);