diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-03-24 23:58:43 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-03-24 23:58:43 +0200 |
commit | 3e76c5767afb48fd81a743bd0bc102eba0b2b611 (patch) | |
tree | 031d83048f307d2c3199556692d7e6c26b424a04 /lib/psm.c | |
parent | 2a909bdd028ddc2c46c00ddaa3b06003b0329ce9 (diff) | |
download | rpm-3e76c5767afb48fd81a743bd0bc102eba0b2b611.tar.gz rpm-3e76c5767afb48fd81a743bd0bc102eba0b2b611.tar.bz2 rpm-3e76c5767afb48fd81a743bd0bc102eba0b2b611.zip |
Avoid couple of static buffers in psm script functions
Diffstat (limited to 'lib/psm.c')
-rw-r--r-- | lib/psm.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -13,6 +13,7 @@ #include <rpm/rpmfileutil.h> /* rpmMkTempFile() */ #include <rpm/rpmdb.h> /* XXX for db_chrootDone */ #include <rpm/rpmlog.h> +#include <rpm/rpmstring.h> #include "rpmio/rpmlua.h" #include "lib/cpio.h" @@ -546,13 +547,14 @@ static rpmRC runLuaScript(rpmpsm psm, Header h, rpmTag stag, rpmluaPop(lua); { - char buf[BUFSIZ]; - xx = snprintf(buf, BUFSIZ, "%s(%s-%s-%s)", sln, n, v, r); + char *buf = NULL; + rasprintf(&buf, "%s(%s-%s-%s)", sln, n, v, r); if (rpmluaRunScript(lua, script, buf) == -1) { void * ptr; ptr = rpmtsNotify(ts, psm->te, RPMCALLBACK_SCRIPT_ERROR, stag, 1); rc = RPMRC_FAIL; } + free(buf); } rpmluaDelVar(lua, "arg"); @@ -799,13 +801,15 @@ static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, if (prefixes != NULL) for (i = 0; i < numPrefixes; i++) { - sprintf(prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]); + rasprintf(&prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]); xx = doputenv(prefixBuf); + prefixBuf = _free(prefixBuf); /* backwards compatibility */ if (i == 0) { - sprintf(prefixBuf, "RPM_INSTALL_PREFIX=%s", prefixes[i]); + rasprintf(&prefixBuf, "RPM_INSTALL_PREFIX=%s", prefixes[i]); xx = doputenv(prefixBuf); + prefixBuf = _free(prefixBuf); } } |