Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
23e5a763
Commit
23e5a763
authored
May 18, 2019
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plist_array_get_item_index(): return UINT_MAX instead of 0 when node can't be found
parent
08c6143b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
plist.h
include/plist/plist.h
+1
-1
Array.cpp
src/Array.cpp
+4
-0
plist.c
src/plist.c
+1
-1
No files found.
include/plist/plist.h
View file @
23e5a763
...
@@ -247,7 +247,7 @@ extern "C"
...
@@ -247,7 +247,7 @@ extern "C"
* Get the index of an item. item must be a member of a #PLIST_ARRAY node.
* Get the index of an item. item must be a member of a #PLIST_ARRAY node.
*
*
* @param node the node
* @param node the node
* @return the node index
* @return the node index
or UINT_MAX if node index can't be determined
*/
*/
uint32_t
plist_array_get_item_index
(
plist_t
node
);
uint32_t
plist_array_get_item_index
(
plist_t
node
);
...
...
src/Array.cpp
View file @
23e5a763
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <plist/Array.h>
#include <plist/Array.h>
#include <algorithm>
#include <algorithm>
#include <limits.h>
namespace
PList
namespace
PList
{
{
...
@@ -118,6 +119,9 @@ void Array::Remove(Node* node)
...
@@ -118,6 +119,9 @@ void Array::Remove(Node* node)
if
(
node
)
if
(
node
)
{
{
uint32_t
pos
=
plist_array_get_item_index
(
node
->
GetPlist
());
uint32_t
pos
=
plist_array_get_item_index
(
node
->
GetPlist
());
if
(
pos
==
UINT_MAX
)
{
return
;
}
plist_array_remove_item
(
_node
,
pos
);
plist_array_remove_item
(
_node
,
pos
);
std
::
vector
<
Node
*>::
iterator
it
=
_array
.
begin
();
std
::
vector
<
Node
*>::
iterator
it
=
_array
.
begin
();
it
+=
pos
;
it
+=
pos
;
...
...
src/plist.c
View file @
23e5a763
...
@@ -430,7 +430,7 @@ PLIST_API uint32_t plist_array_get_item_index(plist_t node)
...
@@ -430,7 +430,7 @@ PLIST_API uint32_t plist_array_get_item_index(plist_t node)
{
{
return
node_child_position
(
father
,
node
);
return
node_child_position
(
father
,
node
);
}
}
return
0
;
return
UINT_MAX
;
}
}
static
void
_plist_array_post_insert
(
plist_t
node
,
plist_t
item
,
long
n
)
static
void
_plist_array_post_insert
(
plist_t
node
,
plist_t
item
,
long
n
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment