Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-grub2
Commits
af435524
Commit
af435524
authored
Jan 20, 2015
by
Vladimir Serbinenko
Browse files
grub_fshelp_read_file: Don't attempt to read past the end of file.
parent
66ce4d1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
af435524
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/fshelp.c (grub_fshelp_read_file): Don't attempt to read
past the end of file.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/lexer.c (grub_script_lexer_yywrap): Update len
grub-core/fs/fshelp.c
View file @
af435524
...
...
@@ -252,6 +252,13 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
grub_disk_addr_t
i
,
blockcnt
;
int
blocksize
=
1
<<
(
log2blocksize
+
GRUB_DISK_SECTOR_BITS
);
if
(
pos
>
filesize
)
{
grub_error
(
GRUB_ERR_OUT_OF_RANGE
,
N_
(
"attempt to read past the end of file"
));
return
-
1
;
}
/* Adjust LEN so it we can't read past the end of the file. */
if
(
pos
+
len
>
filesize
)
len
=
filesize
-
pos
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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