summaryrefslogtreecommitdiff
path: root/lib/rpmvercmp.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-29 13:49:53 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-29 13:49:53 +0300
commit2cef5b46458f2d19825cdc40b21bb591b69f87f0 (patch)
treecdbd6153166decb908659e16d2c4875de08030bb /lib/rpmvercmp.c
parentb5568386c2a16a56a5b290a4e6f498229d7e695f (diff)
downloadrpm-2cef5b46458f2d19825cdc40b21bb591b69f87f0.tar.gz
rpm-2cef5b46458f2d19825cdc40b21bb591b69f87f0.tar.bz2
rpm-2cef5b46458f2d19825cdc40b21bb591b69f87f0.zip
Remove alloca() from rpmvercmp()
- use variable array instead, versions had better be short enough to fit on stack safely
Diffstat (limited to 'lib/rpmvercmp.c')
-rw-r--r--lib/rpmvercmp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/rpmvercmp.c b/lib/rpmvercmp.c
index d3190c1b1..0cdcc6866 100644
--- a/lib/rpmvercmp.c
+++ b/lib/rpmvercmp.c
@@ -16,7 +16,8 @@
int rpmvercmp(const char * a, const char * b)
{
char oldch1, oldch2;
- char * str1, * str2;
+ char abuf[strlen(a)+1], bbuf[strlen(b)+1];
+ char *str1 = abuf, *str2 = bbuf;
char * one, * two;
int rc;
int isnum;
@@ -24,9 +25,6 @@ int rpmvercmp(const char * a, const char * b)
/* easy comparison to see if versions are identical */
if (!strcmp(a, b)) return 0;
- str1 = alloca(strlen(a) + 1);
- str2 = alloca(strlen(b) + 1);
-
strcpy(str1, a);
strcpy(str2, b);