summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-04-27 08:10:32 +0200
committerGravatar Nikias Bassen2022-04-27 08:11:44 +0200
commitddc0c16fd876d45ebd92e924c3124772c3a40654 (patch)
treeae8a4129d2636b1d33d1907c03a06584439b339f
parent51b33f44e7bb7a783cafec47510b9645eced6d63 (diff)
downloadidevicerestore-ddc0c16fd876d45ebd92e924c3124772c3a40654.tar.gz
idevicerestore-ddc0c16fd876d45ebd92e924c3124772c3a40654.tar.bz2
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.
-rw-r--r--src/common.c2
1 files changed, 1 insertions, 1 deletions
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: