diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bplist.c | 33 | ||||
| -rw-r--r-- | src/plist.c | 2 |
2 files changed, 20 insertions, 15 deletions
diff --git a/src/bplist.c b/src/bplist.c index 741a92c..54a4bb2 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -408,15 +408,19 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist) | |||
| 408 | //first one is actually a key | 408 | //first one is actually a key |
| 409 | plist_get_data(nodeslist[index1])->type = PLIST_KEY; | 409 | plist_get_data(nodeslist[index1])->type = PLIST_KEY; |
| 410 | 410 | ||
| 411 | if (G_NODE_IS_ROOT(nodeslist[index1])) | 411 | if (index1 >= 0 && index1 < num_objects) { |
| 412 | g_node_append(nodeslist[i], nodeslist[index1]); | 412 | if (G_NODE_IS_ROOT(nodeslist[index1])) |
| 413 | else | 413 | g_node_append(nodeslist[i], nodeslist[index1]); |
| 414 | g_node_append(nodeslist[i], g_node_copy_deep(nodeslist[index1], copy_plist_data, NULL)); | 414 | else |
| 415 | 415 | g_node_append(nodeslist[i], g_node_copy_deep(nodeslist[index1], copy_plist_data, NULL)); | |
| 416 | if (G_NODE_IS_ROOT(nodeslist[index2])) | 416 | } |
| 417 | g_node_append(nodeslist[i], nodeslist[index2]); | 417 | |
| 418 | else | 418 | if (index2 >= 0 && index2 < num_objects) { |
| 419 | g_node_append(nodeslist[i], g_node_copy_deep(nodeslist[index2], copy_plist_data, NULL)); | 419 | if (G_NODE_IS_ROOT(nodeslist[index2])) |
| 420 | g_node_append(nodeslist[i], nodeslist[index2]); | ||
| 421 | else | ||
| 422 | g_node_append(nodeslist[i], g_node_copy_deep(nodeslist[index2], copy_plist_data, NULL)); | ||
| 423 | } | ||
| 420 | } | 424 | } |
| 421 | 425 | ||
| 422 | free(data->buff); | 426 | free(data->buff); |
| @@ -428,11 +432,12 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist) | |||
| 428 | str_j = j * dict_param_size; | 432 | str_j = j * dict_param_size; |
| 429 | index1 = swap_n_bytes(data->buff + str_j, dict_param_size); | 433 | index1 = swap_n_bytes(data->buff + str_j, dict_param_size); |
| 430 | 434 | ||
| 431 | //g_node_append(nodeslist[i], nodeslist[index1]); | 435 | if (index1 >= 0 && index1 < num_objects) { |
| 432 | if (G_NODE_IS_ROOT(nodeslist[index1])) | 436 | if (G_NODE_IS_ROOT(nodeslist[index1])) |
| 433 | g_node_append(nodeslist[i], nodeslist[index1]); | 437 | g_node_append(nodeslist[i], nodeslist[index1]); |
| 434 | else | 438 | else |
| 435 | g_node_append(nodeslist[i], g_node_copy_deep(nodeslist[index1], copy_plist_data, NULL)); | 439 | g_node_append(nodeslist[i], g_node_copy_deep(nodeslist[index1], copy_plist_data, NULL)); |
| 440 | } | ||
| 436 | } | 441 | } |
| 437 | free(data->buff); | 442 | free(data->buff); |
| 438 | break; | 443 | break; |
diff --git a/src/plist.c b/src/plist.c index 1fafd94..a3d3cb2 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -157,7 +157,7 @@ char compare_node_value(plist_type type, plist_data_t data, void *value, uint64_ | |||
| 157 | res = !wcscmp(data->unicodeval, ((wchar_t *) value)); | 157 | res = !wcscmp(data->unicodeval, ((wchar_t *) value)); |
| 158 | break; | 158 | break; |
| 159 | case PLIST_DATA: | 159 | case PLIST_DATA: |
| 160 | res = memcmp(data->buff,(char*) value, length ); | 160 | res = memcmp(data->buff, (char *) value, length); |
| 161 | break; | 161 | break; |
| 162 | case PLIST_ARRAY: | 162 | case PLIST_ARRAY: |
| 163 | case PLIST_DICT: | 163 | case PLIST_DICT: |
