diff options
author | Richard Braun <rbraun@sceen.net> | 2017-01-06 20:56:01 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-01-06 20:56:01 +0100 |
commit | 059f34b91f705a7451491068668fedab07ee3a24 (patch) | |
tree | 9ed5da064404b71828165b6e68107eec50c5b2b9 /ext2fs/xattr.c | |
parent | 41857c776d63bfed4c14bd882b3c9eade1f52e4d (diff) | |
download | hurd-059f34b91f705a7451491068668fedab07ee3a24.tar.gz hurd-059f34b91f705a7451491068668fedab07ee3a24.tar.bz2 hurd-059f34b91f705a7451491068668fedab07ee3a24.zip |
ext2fs: minor cleanup
Fix some typos, types, add a few checks against integer overflows.
ext2fs/inode.c (diskfs_user_read_node): Initialize datalen to 0.
(diskfs_set_translator): Fix typo.
(diskfs_get_translator): Change datalen type to size_t.
* ext2fs/xattr.c (xattr_entry_get): Change type of block parameter
to void *.
(xattr_entry_create): Guard against integer overflows.
(xattr_entry_replace): Likewise.
(ext2_set_xattr): Fix typo.
Diffstat (limited to 'ext2fs/xattr.c')
-rw-r--r-- | ext2fs/xattr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c index 6507a971..52d3a9c0 100644 --- a/ext2fs/xattr.c +++ b/ext2fs/xattr.c @@ -208,7 +208,7 @@ xattr_entry_list (struct ext2_xattr_entry *entry, char *buffer, size_t *len) * more than 0 otherwise. */ static error_t -xattr_entry_get (char *block, struct ext2_xattr_entry *entry, +xattr_entry_get (void *block, struct ext2_xattr_entry *entry, const char *full_name, char *value, size_t *len, int *cmp) { @@ -282,7 +282,7 @@ xattr_entry_create (struct ext2_xattr_header *header, entry_size = EXT2_XATTR_ENTRY_SIZE (name_len); value_size = EXT2_XATTR_ALIGN (len); - if (entry_size + value_size > rest - 4) + if (rest < 4 || entry_size + value_size > rest - 4) { return ERANGE; } @@ -375,7 +375,7 @@ xattr_entry_replace (struct ext2_xattr_header *header, old_size = EXT2_XATTR_ALIGN (position->e_value_size); new_size = EXT2_XATTR_ALIGN (len); - if (new_size - old_size > rest - 4) + if (rest < 4 || new_size - old_size > rest - 4) return ERANGE; if (new_size != old_size) @@ -750,7 +750,7 @@ ext2_set_xattr (struct node *np, const char *name, const char *value, } else if (err == ENODATA) { - /* The xattr entry are sorted by attribute name */ + /* The xattr entries are sorted by attribute name */ if (cmp < 0 && !found) { location = entry; |