summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-10-25version: increase number of digits supported in version componentTimo Teräs3-3/+8
Report also version numbers as invalid if there's more than 18 digits. fixes #10774
2021-10-04enable uvol support by defaultTimo Teräs1-1/+1
2021-09-13adb: fix --allow-untrusted to work againTimo Teräs2-4/+11
and fix the error code if untrusted adb is seen
2021-09-03test: improve posix sh compatibilityAlex Xu (Hello71)3-5/+5
2021-09-03extract: remove redundant file unlink on failure pathTimo Teräs1-1/+0
apk_extract_file() already calls unlink if the error is fatal.
2021-09-03extract: pass root object instead of databaseTimo Teräs5-19/+19
2021-09-03add: warn when creating empty virtual packagesAlex Xu (Hello71)2-0/+3
see https://gitlab.alpinelinux.org/alpine/aports/-/issues/11736 [TT: minor stylistic change]
2021-08-24tar: include missing limits.hPaul Spooren1-0/+1
Without this header the build fails when used as a OpenWrt build dependency. Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-08-23mkpkg: add support for scripts and triggersTimo Teräs2-1/+37
2021-08-23trust: always use have valid struct apk_trust *Timo Teräs5-25/+26
Make sure we always have valid struct apk_trust * for code using it. Load the signing keys directly when being specified to produce sane error message if loading them fails.
2021-08-23remove IS_ERR_OR_NULLTimo Teräs11-22/+21
In most places where pointer can be an 'error' it cannot be null pointer. Further, in those cases just calling PTR_ERR() is not enough to handle the null case. Simplify code by removing this case. If NULL case needs to be handled, it's better to add separate check and return fixed error code in that case.
2021-08-23extract: support v3 index verificationTimo Teräs2-5/+29
2021-08-23tar: improve compatibilityTimo Teräs1-20/+30
- check magic field for 'ustar' on read - harden get_octal to report errors on non-octal characters (e.g. GNU base256 encoding), fixes #10757 - fix mtime and size octal fields to not have zero terminator
2021-08-23db: honor SOURCE_DATE_EPOCH for scriptdbTimo Teräs1-2/+0
fixes #10762
2021-08-23list: recognize both --upgradable and --upgradeableTimo Teräs2-2/+4
fixes #10759
2021-08-17extract: fix directory handlingTimo Teräs1-7/+8
'is' is null for directories
2021-08-03extract: fix --force-overwriteTimo Teräs1-1/+1
Directories are handled specially in package installation code, but extract applet uses also apk_extract_file() to create directories. These should not be unlinked as that fails with unexpected error code terminating the extraction.
2021-08-03libfetch: fix http chunked mode handlingTimo Teräs1-1/+1
Unbreak handling of base 16 in fetch_parseuint(). It is used only in http chunked mode handling. Fixes: "libfetch: fix range checking for http/ftp protocol parsing"
2021-08-03extract: fix extracting untrusted packageTimo Teräs2-3/+6
2021-07-30manifest: support v3 packagesTimo Teräs1-0/+42
2021-07-30verify: support v3 packagesTimo Teräs2-4/+24
2021-07-30mkndx: support v3 packagesTimo Teräs1-0/+14
2021-07-30extract: use extraction api, and implement it for v3 packagesTimo Teräs6-209/+298
The extract applet now works with both v2 and v3 packages.
2021-07-27Further refactor extract API to have separate ops vtableTimo Teräs7-135/+162
This splits the callbacks by type, and further prepares the API to be usable for v3 files too.
2021-07-27Refactor .apk extraction codeTimo Teräs25-749/+744
This moves and isolates the tar code to tar.c. And the actual file extraction to disk is moved to extract.c. A new API is introduced and used for v2 file extraction. This essentially moves and isolates the apk_sign_ctx_* beast into extract_v2.c and offers a saner interface to handling packages. A place holder is added for v3 extraction.
2021-07-26extract: fix handling of error of regular file extractionTimo Teräs2-3/+16
fix the error checking, allow --force-overwrite to work and do not delete existing file in case of error
2021-07-26libfetch: fix range checking for http/ftp protocol parsingTimo Teräs5-61/+70
Various parsing of numeric strings were not having adequate range checking causing information leak or potential crash. CVE-2021-36159 fixes #10749 Co-authored-by: Ariadne Conill <ariadne@dereferenced.org> Reported-by: Samanta Navarro <ferivoz@riseup.net>
2021-07-26adb: fix some error handling pathsTimo Teräs3-9/+9
2021-07-26db: add some error checking to database state writeTimo Teräs2-40/+51
Make errors more observable. Unfortunately full rollback is non-trivial to implement. This is something to be fixed with the v3 database format.
2021-07-26db: fix installed db writing with long namesSamanta Navarro1-5/+10
Packages containing files with path names longer than 1024 characters cannot fit into the buffer which is used to write "installed" database. This leads to bbuf being APK_BLOB_NULL in apk_db_write_fdb because apk_blob_push_blob notices the condition and correctly handles it. The problem occurs when arguments to apk_ostream_write are manually calculated by pointer arithmetics. Since bbuf.ptr is NULL in such a case, bbuf.ptr - buf leads to a huge size value while buf still points into the stack. fixes #10751 [TT: minor edit to commit and abbreviating the commit message]
2021-07-26Use __attribute__ ((format)) where possible and fix issues found by itTimo Teräs4-8/+9
2021-07-26adb: adb_walk_adb fix out of boundary writeTimo Teräs3-37/+58
If a signature is longer than max allowed adb signature length then adb_walk_block writes out of boundary of stack variable tmp. The len += snprintf is not safe per standard snprintf implementation (kernel does it differently). Introduce and use apk_blob_push_fmt which does the checking better. Fixes #10752 Reported-by: Samanta Navarro <ferivoz@riseup.net>
2021-07-25io_archive: Use SOURCE_DATE_EPOCH for meta files instead of current timekpcyrd3-1/+18
[TT: minor stylistic changes]
2021-07-25adb: fix error handling of non-adb filesTimo Teräs2-3/+7
2021-07-23db: allow read-only operations without cacheTimo Teräs4-4/+24
fixes #10748
2021-07-23extract: rework uvol name logicTimo Teräs2-15/+16
Add uvol_name to struct apk_file_info so it can be passed down the extract callbacks in future work. Modify uvol name to not include the path, but just the filename portion.
2021-07-23extract: fix uvol parameter orderDaniel Golle1-1/+1
2021-07-22extract: remove unneeded argument from uvol_extractTimo Teräs1-3/+3
2021-07-22adb: add a small adb blob header with versions and root objectTimo Teräs5-39/+74
2021-07-22adb: refactor struct adb_header to adb_file_headerTimo Teräs4-39/+37
In struct adb, do not keep the whole header, just the schema in host byte order.
2021-07-22adb: make adb mmap/stream parser more united, add ADB_BLOCK_DATAXTimo Teräs4-47/+61
Harden the error checking of expected block types and their order. Add ADB_BLOCK_DATAX as reserved for >1GB blocks.
2021-07-22adb, convndx: check istream_close resultTimo Teräs2-3/+2
2021-07-22io: make apk_istream_get/read() fail on incomplete readTimo Teräs5-59/+44
2021-07-22io: formalize apk_ostream_write() always writing full dataTimo Teräs6-60/+46
2021-07-22rework apk_istream_splice and apk_istream_teeTimo Teräs10-204/+120
- apk_istream_splice usage is converted to apk_stream_copy which is the newer variant. With caching enabled by default, this makes more sense mmapping or using separate buffers. - apk_istream_tee is reworked to write to apk_ostream, which simplifies quite a bit of various things
2021-07-22io: rework apk_istream_get_* to not return erros in blob valueTimo Teräs10-66/+68
The interface was slightly cumbersome, so replace these functions to return explicit error, and make the return blob a pointer arg.
2021-07-22adb: remove the now unused get_default_int() hookTimo Teräs2-8/+1
It is no longer needed, and can be later reintroduced if needed.
2021-07-22adb: unify various interfaces to adb_m_processTimo Teräs12-220/+252
Removes code duplication, and puts important checks in one place. Support seamless decompression in adbdump.
2021-07-22adbsign: support compressed adb filesTimo Teräs4-6/+9
2021-07-22adb: support seamless de/compression of adb filesTimo Teräs9-22/+111
Add compression header of adb files. Support uncompressed and deflate compression at this time.