Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109365926
D36773.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36773.diff
View Options
diff --git a/sys/geom/linux_lvm/g_linux_lvm.c b/sys/geom/linux_lvm/g_linux_lvm.c
--- a/sys/geom/linux_lvm/g_linux_lvm.c
+++ b/sys/geom/linux_lvm/g_linux_lvm.c
@@ -67,7 +67,8 @@
static int g_llvm_read_md(struct g_consumer *, struct g_llvm_metadata *,
struct g_llvm_label *);
-static int llvm_label_decode(const u_char *, struct g_llvm_label *, int);
+static int llvm_label_decode(const u_char *, struct g_llvm_label *,
+ int, u_int);
static int llvm_md_decode(const u_char *, struct g_llvm_metadata *,
struct g_llvm_label *);
static int llvm_textconf_decode(u_char *, int,
@@ -637,7 +638,8 @@
/* Search the four sectors for the LVM label. */
for (i = 0; i < 4; i++) {
- error = llvm_label_decode(&buf[i * pp->sectorsize], ll, i);
+ error = llvm_label_decode(&buf[i * pp->sectorsize], ll, i,
+ pp->sectorsize);
if (error == 0)
break; /* found it */
}
@@ -703,7 +705,8 @@
}
static int
-llvm_label_decode(const u_char *data, struct g_llvm_label *ll, int sector)
+llvm_label_decode(const u_char *data, struct g_llvm_label *ll, int sector,
+ u_int sectorsize)
{
uint64_t off;
char *uuid;
@@ -728,6 +731,13 @@
return (EINVAL);
}
+ /* XXX The minimal possible size of physical volume header is 88 */
+ if (ll->ll_offset < 32 || ll->ll_offset > sectorsize - 88) {
+ G_LLVM_DEBUG(0, "Invalid physical volume header offset %u",
+ ll->ll_offset);
+ return (EINVAL);
+ }
+
off = ll->ll_offset;
/*
* convert the binary uuid to string format, the format is
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 5, 3:12 AM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16465932
Default Alt Text
D36773.diff (1 KB)
Attached To
Mode
D36773: geom_linux_lvm: Check the offset of physical volume header
Attached
Detach File
Event Timeline
Log In to Comment