diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-05-10 11:49:24 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-05-10 11:49:24 +0300 |
commit | db782b4b62ea6edd3510f60a5875f2c884b08575 (patch) | |
tree | 98ce57ff6d97591e087445060a75b3ff0557ac97 /rpmio/macro.c | |
parent | 6101cac6b3357fab763636da53d52ea9810cb54f (diff) | |
download | rpm-db782b4b62ea6edd3510f60a5875f2c884b08575.tar.gz rpm-db782b4b62ea6edd3510f60a5875f2c884b08575.tar.bz2 rpm-db782b4b62ea6edd3510f60a5875f2c884b08575.zip |
Keep the macro buffer terminated on append
- This isn't strictly needed as we're terminating the buffers "just in
case" all over the place but handling this centrally might allow
some day eliminating the other fluff...
Diffstat (limited to 'rpmio/macro.c')
-rw-r--r-- | rpmio/macro.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rpmio/macro.c b/rpmio/macro.c index 4c641fcd5..238ebcdde 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -442,6 +442,7 @@ static void mbAppend(MacroBuf mb, char c) mb->nb += MACROBUFSIZ; } mb->buf[mb->tpos++] = c; + mb->buf[mb->tpos] = '\0'; mb->nb--; } @@ -452,7 +453,7 @@ static void mbAppendStr(MacroBuf mb, const char *str) mb->buf = xrealloc(mb->buf, mb->tpos + mb->nb + MACROBUFSIZ + len + 1); mb->nb += MACROBUFSIZ + len; } - memcpy(mb->buf+mb->tpos, str, len); + memcpy(mb->buf+mb->tpos, str, len + 1); mb->tpos += len; mb->nb -= len; } |