Commit 9303baa3 authored by Petri Hintukainen's avatar Petri Hintukainen

Use information length instead of file size when parsing inline directory files

parent 1a4788b3
...@@ -306,6 +306,7 @@ static struct file_entry *_decode_file_entry(const uint8_t *p, size_t size, ...@@ -306,6 +306,7 @@ static struct file_entry *_decode_file_entry(const uint8_t *p, size_t size,
/* data of small files can be embedded in file entry */ /* data of small files can be embedded in file entry */
/* copy embedded file data */ /* copy embedded file data */
fe->content_inline = 1; fe->content_inline = 1;
fe->u.data.information_length = l_ad;
memcpy(fe->u.data.content, p + p_ad, l_ad); memcpy(fe->u.data.content, p + p_ad, l_ad);
} else { } else {
fe->u.ads.num_ad = num_ad; fe->u.ads.num_ad = num_ad;
......
...@@ -223,6 +223,7 @@ struct file_entry { ...@@ -223,6 +223,7 @@ struct file_entry {
/* inline file */ /* inline file */
struct { struct {
uint32_t information_length; /* recorded information length, may be different than file length */
uint8_t content[1]; /* content of small files is embedded here */ uint8_t content[1]; /* content of small files is embedded here */
} data; } data;
} u; } u;
......
...@@ -963,7 +963,7 @@ static struct udf_dir *_read_dir(udfread *udf, const struct long_ad *icb) ...@@ -963,7 +963,7 @@ static struct udf_dir *_read_dir(udfread *udf, const struct long_ad *icb)
if (fe->content_inline) { if (fe->content_inline) {
dir = (struct udf_dir *)calloc(1, sizeof(struct udf_dir)); dir = (struct udf_dir *)calloc(1, sizeof(struct udf_dir));
if (dir) { if (dir) {
if (_parse_dir(&fe->u.data.content[0], fe->length, dir) < 0) { if (_parse_dir(&fe->u.data.content[0], fe->u.data.information_length, dir) < 0) {
udf_error("failed parsing inline directory file\n"); udf_error("failed parsing inline directory file\n");
_free_dir(&dir); _free_dir(&dir);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment