diff options
| author | 2019-05-20 01:24:15 +0200 | |
|---|---|---|
| committer | 2019-05-20 01:24:15 +0200 | |
| commit | 17546f53ac1377b0d4f45a800aaec7366ba5b6a0 (patch) | |
| tree | 36b7df46cfb2d6a87c8713f4c357210fd06a10b1 | |
| parent | ea37ed01b8c7e05078620ed039899ddff48eac1c (diff) | |
| download | libplist-17546f53ac1377b0d4f45a800aaec7366ba5b6a0.tar.gz libplist-17546f53ac1377b0d4f45a800aaec7366ba5b6a0.tar.bz2 | |
plist_set_key_val(): prevent setting a key value that already exists in a PLIST_DICT
| -rw-r--r-- | src/plist.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c index 29dbfb7..6d7a07f 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -1067,6 +1067,11 @@ static void plist_set_element_val(plist_t node, plist_type type, const void *val | |||
| 1067 | 1067 | ||
| 1068 | PLIST_API void plist_set_key_val(plist_t node, const char *val) | 1068 | PLIST_API void plist_set_key_val(plist_t node, const char *val) |
| 1069 | { | 1069 | { |
| 1070 | plist_t father = plist_get_parent(node); | ||
| 1071 | plist_t item = plist_dict_get_item(father, val); | ||
| 1072 | if (item) { | ||
| 1073 | return; | ||
| 1074 | } | ||
| 1070 | plist_set_element_val(node, PLIST_KEY, val, strlen(val)); | 1075 | plist_set_element_val(node, PLIST_KEY, val, strlen(val)); |
| 1071 | } | 1076 | } |
| 1072 | 1077 | ||
