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
This commit is contained in:
@@ -713,13 +713,13 @@ static void get_device_scrypt_params(struct crypt_mnt_ftr *ftr) {
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user