summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-29 11:26:00 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-29 11:26:00 +0300
commit4114a51af8e2bbdbe0a243639be1bd496c469885 (patch)
treecd2407131f6b369d059176bce6f1d7173bac5b77 /lib
parente80494b132dfd3c48bff1e03ad5b2f0f8900274c (diff)
downloadrpm-4114a51af8e2bbdbe0a243639be1bd496c469885.tar.gz
rpm-4114a51af8e2bbdbe0a243639be1bd496c469885.tar.bz2
rpm-4114a51af8e2bbdbe0a243639be1bd496c469885.zip
Avoid alloca() in rpmDetectPGPVersion()
- the whole detection is hysterical and could/should probably be killed but what the heck...
Diffstat (limited to 'lib')
-rw-r--r--lib/signature.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/signature.c b/lib/signature.c
index 5fce365a1..b1e238fbd 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -73,7 +73,7 @@ const char * rpmDetectPGPVersion(pgpVersion * pgpVer)
char *pgpbin = rpmGetPath("%{?_pgpbin}", NULL);
if (saved_pgp_version == PGP_UNKNOWN) {
- char *pgpvbin;
+ char *pgpvbin = NULL;
struct stat st;
if (!(pgpbin && pgpbin[0] != '\0')) {
@@ -81,8 +81,7 @@ const char * rpmDetectPGPVersion(pgpVersion * pgpVer)
saved_pgp_version = -1;
return NULL;
}
- pgpvbin = (char *)alloca(strlen(pgpbin) + sizeof("v"));
- (void)stpcpy(stpcpy(pgpvbin, pgpbin), "v");
+ rasprintf(&pgpvbin, "%sv", pgpbin);
if (stat(pgpvbin, &st) == 0)
saved_pgp_version = PGP_5;
@@ -90,6 +89,7 @@ const char * rpmDetectPGPVersion(pgpVersion * pgpVer)
saved_pgp_version = PGP_2;
else
saved_pgp_version = PGP_NOTDETECTED;
+ free(pgpvbin);
}
if (pgpVer && pgpbin)