From ddc0c16fd876d45ebd92e924c3124772c3a40654 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 27 Apr 2022 08:10:32 +0200 Subject: Fix restore for devices that don't have eUICC Because of a default value of (uint64_t)-1LL returned when _plist_dict_get_uint doesn't find the dictionary entry for the given key, a later comparison of that unsigned value against something like >= 5 will result in the condition being true even though it was not supposed to. _plist_dict_get_uint will now return a default value of 0 if the key is not found. Code paths that deal with actual values of 0 vs. non-existent values need to test the existence of the key deal with that; I am currently not aware of anything that would be affected. --- src/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.c b/src/common.c index 89cd86d..068f2dd 100644 --- a/src/common.c +++ b/src/common.c @@ -564,7 +564,7 @@ uint64_t _plist_dict_get_uint(plist_t dict, const char *key) uint64_t strsz = 0; plist_t node = plist_dict_get_item(dict, key); if (!node) { - return (uint64_t)-1LL; + return uintval; } switch (plist_get_node_type(node)) { case PLIST_UINT: -- cgit v1.1-32-gdbae