summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2006-09-30 21:05:25 +0000
committerDenis Vlasenko2006-09-30 21:05:25 +0000
commitaecabffb8bf47ee8bf02c1fa1011ca97fc0b97d4 (patch)
treeb98e63385113a140150a3a4d2b929861a089a212
parent55a994055ff2c391aeec377dbb1e6b3c096334d2 (diff)
downloadbusybox-aecabffb8bf47ee8bf02c1fa1011ca97fc0b97d4.zip
busybox-aecabffb8bf47ee8bf02c1fa1011ca97fc0b97d4.tar.gz
dpkg: fix use-after-free (bug 939)
-rw-r--r--archival/dpkg.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index b26a116..b558224 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -304,16 +304,13 @@ static int version_compare(const unsigned int ver1, const unsigned int ver2)
deb_ver2++;
}
result = version_compare_part(upstream_ver1, upstream_ver2);
+ if (!result)
+ /* Compare debian versions */
+ result = version_compare_part(deb_ver1, deb_ver2);
free(upstream_ver1);
free(upstream_ver2);
-
- if (result != 0) {
- return result;
- }
-
- /* Compare debian versions */
- return version_compare_part(deb_ver1, deb_ver2);
+ return result;
}
static int test_version(const unsigned int version1, const unsigned int version2, const unsigned int operator)