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
d5e1de67
Commit
d5e1de67
authored
May 22, 2014
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xplist: Fix PLIST_DATE handling to respect the Mac epoch
parent
1317925f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
xplist.c
src/xplist.c
+4
-2
No files found.
src/xplist.c
View file @
d5e1de67
...
...
@@ -51,6 +51,8 @@
#define XPLIST_ARRAY BAD_CAST("array")
#define XPLIST_DICT BAD_CAST("dict")
#define MAC_EPOCH 978307200
static
const
char
*
plist_base
=
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
\
<!DOCTYPE plist PUBLIC
\"
-//Apple//DTD PLIST 1.0//EN
\"
\"
http://www.apple.com/DTDs/PropertyList-1.0.dtd
\"
>
\n
\
<plist version=
\"
1.0
\"
>
\n
\
...
...
@@ -222,7 +224,7 @@ static void node_to_xml(node_t* node, void *xml_struct)
case
PLIST_DATE
:
tag
=
XPLIST_DATE
;
{
time_t
timev
=
(
time_t
)
node_data
->
timeval
.
tv_sec
;
time_t
timev
=
(
time_t
)
node_data
->
timeval
.
tv_sec
+
MAC_EPOCH
;
struct
tm
*
btime
=
gmtime
(
&
timev
);
if
(
btime
)
{
val
=
(
char
*
)
malloc
(
24
);
...
...
@@ -404,7 +406,7 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node)
tm_utc
=
gmtime
(
&
timev
);
timev
-=
(
mktime
(
tm_utc
)
-
timev
);
}
data
->
timeval
.
tv_sec
=
(
long
)
timev
;
data
->
timeval
.
tv_sec
=
(
long
)
(
timev
-
MAC_EPOCH
)
;
data
->
timeval
.
tv_usec
=
0
;
data
->
type
=
PLIST_DATE
;
data
->
length
=
sizeof
(
struct
timeval
);
...
...
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