diff options
author | Allan McRae <allan@archlinux.org> | 2013-10-14 21:04:22 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-10-15 12:40:53 +1000 |
commit | e049bb8bd6bb3b8aacf371abde937d2270cfa451 (patch) | |
tree | 683f5a1376807dd26f5daadd2b7e1d2f5b04623b | |
parent | e7ad883ebe41a25a63f4349ea08d589ec48c3539 (diff) |
Ensure packages have a valid version
Currently you can manually create and then install a package with a
version not containing a pkgrel. The created local database entry is
invalid as the directory name can not be split by _alpm_splitname due
to the assumtion of hyphens separating name-pkgver-pkgrel.
Ensure the package has a valid version when it is loaded. Fixes FS#35514.
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | lib/libalpm/be_package.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 62626212..526d9276 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -413,6 +413,10 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, _alpm_log(handle, ALPM_LOG_ERROR, _("missing package version in %s\n"), pkgfile); goto pkg_invalid; } + if(strchr(newpkg->version, '-') == NULL) { + _alpm_log(handle, ALPM_LOG_ERROR, _("invalid package version in %s\n"), pkgfile); + goto pkg_invalid; + } config = 1; continue; } else if(strcmp(entry_name, ".INSTALL") == 0) { |