commit | 2dd66f4962436fe0f90790278a15c5ce88e85ff0 | [log] [tgz] |
---|---|---|
author | nijel8 <nijel8@gmail.com> | Sat Feb 18 21:15:41 2017 -0500 |
committer | _that <android@that.at> | Sun Feb 19 21:34:12 2017 +0100 |
tree | f5563a618ac3e445304812cd660d6acb76787239 | |
parent | 91758440d3bd350b30a384c07ff1c827f14a12fe [diff] |
cryptfs: Fix encryption issue due to stack corruption. Ioctl BLKGETSIZE expects pointer to unsigned long as argument. On 64bit target using pointer to unsigned int can cause stack corruption due to type mismatch. props to https://github.com/aopp/android_system_vold/commit/f8b8787317fc94439b63bc891eeda83f7ae2f4f6 Change-Id: I1d76c65e29479c8f0cd44b6892069b21b8249b95
diff --git a/crypto/lollipop/cryptfs.c b/crypto/lollipop/cryptfs.c index 986507e..f082206 100644 --- a/crypto/lollipop/cryptfs.c +++ b/crypto/lollipop/cryptfs.c
@@ -713,13 +713,13 @@ static unsigned int get_blkdev_size(int fd) { - unsigned int nr_sec; + unsigned long nr_sec; if ( (ioctl(fd, BLKGETSIZE, &nr_sec)) == -1) { nr_sec = 0; } - return nr_sec; + return (unsigned int) nr_sec; } static int get_crypt_ftr_info(char **metadata_fname, off64_t *off)