Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jean-Baptiste Kempf
libaacs
Commits
da8a5fb8
Commit
da8a5fb8
authored
May 06, 2015
by
npzacs
Browse files
check memory allocation result
parent
9c73ea81
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libaacs/content_cert.c
View file @
da8a5fb8
...
...
@@ -64,11 +64,11 @@ CONTENT_CERT *cc_parse(const void *data, size_t len)
/* return useful data */
CONTENT_CERT
*
c
=
calloc
(
1
,
sizeof
(
CONTENT_CERT
));
c
->
bus_encryption_enabled_flag
=
p
[
1
]
>>
7
;
memcpy
(
c
->
cc_id
,
p
+
14
,
6
);
memcpy
(
c
->
bdj_root_cert_hash
,
p
+
46
,
20
);
if
(
c
)
{
c
->
bus_encryption_enabled_flag
=
p
[
1
]
>>
7
;
memcpy
(
c
->
cc_id
,
p
+
14
,
6
);
memcpy
(
c
->
bdj_root_cert_hash
,
p
+
46
,
20
);
}
return
c
;
}
...
...
src/libaacs/mmc.c
View file @
da8a5fb8
...
...
@@ -255,9 +255,15 @@ static uint8_t *_mmc_read_mkb(MMC *mmc, uint8_t agid, int address, int *size)
if
(
_mmc_report_disc_structure
(
mmc
,
agid
,
0x83
,
layer
,
address
,
buf
,
sizeof
(
buf
)))
{
unsigned
pack
,
num_packs
=
buf
[
3
];
int32_t
len
=
MKINT_BE16
(
buf
)
-
2
;
mkb
=
malloc
(
32768
*
num_packs
);
BD_DEBUG
(
DBG_MMC
,
"got mkb: pack 0/%d %d bytes
\n
"
,
num_packs
,
len
);
mkb
=
malloc
(
32768
*
num_packs
);
if
(
!
mkb
)
{
BD_DEBUG
(
DBG_MMC
|
DBG_CRIT
,
"out of memory
\n
"
);
return
NULL
;
}
memcpy
(
mkb
,
buf
+
4
,
len
);
*
size
+=
len
;
...
...
@@ -347,6 +353,9 @@ MMC *mmc_open(const char *path)
}
mmc
=
calloc
(
1
,
sizeof
(
MMC
));
if
(
!
mmc
)
{
return
NULL
;
}
crypto_create_nonce
(
mmc
->
host_nonce
,
sizeof
(
mmc
->
host_nonce
));
...
...
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