Richard Hughes
89d45a0d91
trivial: Standardize on introspection for @error and @cancellable
...
Also standarize on `Returns:` for the result.
2021-04-28 16:19:50 +01:00
Richard Hughes
1ac05ef3bd
trivial: Codespell fixes
2021-04-26 10:29:39 +01:00
Richard Hughes
d42bd85059
trivial: Do not use the deprecated allow-none introspection argument
...
It's been deprecated since 2014... oops.
https://blogs.gnome.org/desrt/2014/05/27/allow-none-is-dead-long-live-nullable/
2021-04-19 14:46:42 +01:00
Richard Hughes
7f6f525f21
Add fu_bytes_get_data_safe() to check for zero sized data
...
Fixes https://github.com/fwupd/fwupd/issues/3122
2021-04-10 13:20:07 +01:00
Richard Hughes
4d76d18d35
Set the system battery state and level on the FuContext shared state
...
This allows plugins to set the battery power state of the *machine* which means
we can automatically inhibit devices with FWUPD_DEVICE_FLAG_REQUIRE_AC set.
It also allows to set the BatteryThreshold to 25% for Lenovo hardware, and we
can override other vendors with further quirks as required.
Fixes https://github.com/fwupd/fwupd/issues/3084
2021-04-07 08:05:15 +01:00
Richard Hughes
9c318a5a08
trivial: Fix 32 bit overflow in fu_common_get_memory_size()
...
Spotted by Coverity, thanks!
2021-03-20 17:32:56 +00:00
Norbert Kamiński
76e19930a8
fwupd port for BSD distros
...
Signed-off-by: Norbert Kamiński <norbert.kaminski@3mdeb.com>
2021-03-19 17:05:09 +00:00
Richard Hughes
119d260bd2
trivial: Limit alignment to 2GB to fix a fuzzing crash
...
This meant defining alignment values in FuFirmware.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32131
2021-03-17 11:14:46 +00:00
Richard Hughes
52441f28a4
Allow objects to deserialize to XML
...
This makes a lot more sense; we can parse a firmware and export the same XML
we would use in a .builder.xml file. This allows us to two two things:
* Check we can round trip from XML -> binary -> XML
* Using a .builder.xml file we can check ->write() is endian safe
2021-03-15 12:07:30 +00:00
Richard Hughes
74db340d93
trivial: Add fu_byte_array_align_up() for future usage
2021-03-11 15:47:13 +00:00
Richard Hughes
58d52ede18
trivial: Add fu_common_align_up() for future usage
2021-03-10 17:06:57 +00:00
Richard Hughes
e9664e8448
trivial: Add fu_byte_array_append_bytes() helper
2021-03-10 14:01:11 +00:00
Richard Hughes
2d84386034
Remove unused, unsafe and deprecated functions from libfwupdplugin
...
Keeping *internal* API and ABI compatibility makes working with an already
complex codebase more mentally demanding than it needs to be.
Remember: plugins should be in-tree and upstream! If your out of tree plugin
stops working then it should be upstream.
The public-facing libfwupd will remain API and ABI stable for obvious reasons.
2021-03-09 15:47:56 +00:00
Richard Hughes
f2849d24cc
Add missing uint64 read and write helpers
2021-03-05 19:34:54 +00:00
Richard Hughes
32ffdb2677
Add helper API to write in a safer way
2021-03-05 09:34:18 +00:00
Richard Hughes
2ad99bb402
Relax fu_common_bytes_pad() to return the blob if longer than the pad size
...
This means the caller does not have to do this each time.
2021-03-03 14:29:29 +00:00
Richard Hughes
ad3cfc0fea
Convert MBR types to GPT GUIDs to help find the ESP
...
Fixes https://github.com/fwupd/fwupd/issues/2916
2021-02-22 13:00:33 +00:00
Richard Hughes
ffbb1175d0
trivial: Do not consider all whitespace a valid strsafe string
2021-02-14 22:03:57 +00:00
Richard Hughes
a4e0de462c
trivial: Fix AddressSanitizer heap-buffer-overflow
2021-02-14 22:03:57 +00:00
Mario Limonciello
be220a4f56
trivial: fu-common: fix fallback for esp-path if udisks missing
...
Fixes : #2803
2021-02-10 11:58:37 -06:00
Richard Hughes
c123bee369
trivial: Fix a buffer-overread spotted by AddressSanitizer
2021-02-09 13:05:09 +00:00
Richard Hughes
5294d0c7c0
trivial: Use g_memdup2() on new glib2 versions to avoid a warning
2021-02-05 09:50:02 +00:00
Richard Hughes
9b11af985f
Add fu_memdup_safe()
...
See https://mail.gnome.org/archives/desktop-devel-list/2021-February/msg00000.html
for more details.
2021-02-04 21:01:00 +00:00
Richard Hughes
c75466751d
trivial: Add fu_common_uri_get_scheme() for future use
2021-01-28 15:05:32 +00:00
Richard Hughes
e52e1b49ad
trivial: Add fu_common_strjoin_array() to join arrays of strings
2021-01-26 14:25:56 +00:00
Richard Hughes
68175e9ba8
Use a quarter of the RAM size as the archive maximum
...
It is impossible to choose a static default that is appropriate for both a tiny
ARM IoT device and a giant Xeon server.
Fixes https://github.com/fwupd/fwupd/issues/2760
2021-01-14 22:36:38 +00:00
Richard Hughes
97ad335e4b
Fix OOM when using large ArchiveSizeMax values
...
Read from the file descriptor in 32kB chunks rather than allocating a huge
buffer upfront.
2021-01-14 22:36:38 +00:00
Richard Hughes
5add3a75dd
Make libarchive optional for fuzzing
2021-01-13 20:12:37 +00:00
Richard Hughes
b63cfa90d6
Detect the AMD TSME encryption state for HSI
2021-01-06 16:45:33 +00:00
Richard Hughes
364e2685ca
Do not show unprintable chars from invalid firmware in the logs
2021-01-05 15:15:07 +00:00
Richard Hughes
6a489a9eaf
trivial: Add missing calls to g_return_val_if_fail()
2021-01-04 15:24:35 +00:00
Mario Limonciello
ed4e9123c6
trivial: libfwupdplugin: don't fail to set up bwrap if /lib64 doesn't exist
...
Fixes : #2690
2020-12-16 07:56:09 +00:00
Richard Hughes
9d20bf9212
Do not trust the Block.HintSystem boolean for ESP filtering
...
Instead use it for preferential selection. If there is none it's okay, but if
there are 3 pick the one with the flag.
Fixes https://github.com/fwupd/fwupd/issues/2676
2020-12-15 15:42:13 +00:00
Richard Hughes
05e3377d11
trivial: Add fu_common_bytes_new_offset()
...
This is a safer version of g_bytes_new_from_bytes() which returns a GError
if the offsets are invalid rather than emitting a critical warning.
This prevents a critical warning and potential crash when parsing invalid
bcm57xx firmware.
2020-12-08 20:54:25 +00:00
Mario Limonciello
56d816a53b
Fall back to FAT32 internal partitions for detecting ESP
...
Fixes #2576
2020-11-12 13:42:21 -06:00
Richard Hughes
e0f9207d3b
trivial: Fix two introspection warnings
2020-11-06 09:57:03 +00:00
Richard Hughes
0bdf561035
Use UDisks to find out if swap devices are encrypted
...
Using a heuristic is certainly not awesome.
2020-11-02 14:22:37 +00:00
Richard Hughes
2b188c8488
trivial: Export if the volume is encrypted
...
This requires passing in the udisks block proxy when creating the object.
2020-11-02 14:22:37 +00:00
Richard Hughes
f3993a6b96
trivial: Add GObject properties to FuVolume
...
This will allow us to add other properties in the future.
2020-11-02 14:22:37 +00:00
Richard Hughes
43417b2a95
trivial: Return GDBusProxy objects from fu_common_get_block_devices()
...
This allows us to reuse the GDBusConnection without passing it to all places a
new interface proxy is created.
2020-11-02 14:22:37 +00:00
Richard Hughes
c57a8f5726
trivial: Fix GtkDoc for fu_common_get_block_devices()
2020-11-02 14:22:37 +00:00
Richard Hughes
a2a8f8ea70
Add fu_byte_array_set_size()
...
The GLib g_byte_array_set_size() function does not zero the contents if the
array size is larger, which leads to unpredictable output when using valgrind.
2020-10-20 19:54:07 +01:00
Mario Limonciello
5a83563701
uefi: Correct a logic error with FuVolume
...
Fixes : #2443
2020-10-08 09:16:32 -05:00
Mario Limonciello
d4155ff673
trivial: fu-common: don't mention making directories unless they don't exist
2020-09-28 15:58:53 -05:00
Richard Hughes
44ae2a75e4
trivial: Add CRC8 as well
2020-09-25 18:00:21 +01:00
Richard Hughes
6f5e35a3ea
Add common CRC routines
...
We have quite a few versions of CRC in-tree, and are about to get two more...
2020-09-25 17:52:43 +01:00
Richard Hughes
db344d5a40
trivial: Fix several small memory leaks discovered with valgrind
2020-09-09 14:16:49 -05:00
Richard Hughes
2506dbff6f
trivial: Use the same indent size when appending key values
2020-09-03 16:50:41 +01:00
Richard Hughes
7c4a64b833
trivial: Ensure EAX is set to 0x0 when calling CPUID
...
This fixes getting the 'Extended Features' from the CPU.
2020-08-24 16:37:27 +01:00
Richard Hughes
bd1dc2a1e2
pcb-bcr: Use the correct BCR register for Bay Trail CPUs
...
Fixes https://github.com/fwupd/fwupd/issues/2328
2020-08-20 22:07:05 +01:00