summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wright2017-01-19 06:56:06 -0600
committerElliott Hughes2017-02-09 16:45:25 -0600
commit344e929e6d8cc2925e55d7f72262002fcc181f52 (patch)
treec7f7eb420791e81f835a2a2f681e7d2105716278 /toolbox
parent01b25ab14912712024d5342064c7b70de85e2db8 (diff)
downloadplatform-system-core-344e929e6d8cc2925e55d7f72262002fcc181f52.tar.gz
platform-system-core-344e929e6d8cc2925e55d7f72262002fcc181f52.tar.xz
platform-system-core-344e929e6d8cc2925e55d7f72262002fcc181f52.zip
Only allow system to write to existing input nodes.
This prevents the shell user from injecting input as if it were coming from an existing input device, which in turn makes it easier for malware / abuse analysis to detect when someone is injecting input via the command line vs a real user using a device. (cherrypick of 95637eb2a332b9a09914b1bf32c10fccfba4a175.) Bug: 30861057 Test: ran getevent, saw correct output, played with device Change-Id: Ib53eea1b7767f25510b5d36fe6109101a9fad8e0
Diffstat (limited to 'toolbox')
-rw-r--r--toolbox/getevent.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toolbox/getevent.c b/toolbox/getevent.c
index e6def6bae..1fb315cb5 100644
--- a/toolbox/getevent.c
+++ b/toolbox/getevent.c
@@ -321,7 +321,7 @@ static int open_device(const char *device, int print_flags)
321 char idstr[80]; 321 char idstr[80];
322 struct input_id id; 322 struct input_id id;
323 323
324 fd = open(device, O_RDWR); 324 fd = open(device, O_RDONLY);
325 if(fd < 0) { 325 if(fd < 0) {
326 if(print_flags & PRINT_DEVICE_ERRORS) 326 if(print_flags & PRINT_DEVICE_ERRORS)
327 fprintf(stderr, "could not open %s, %s\n", device, strerror(errno)); 327 fprintf(stderr, "could not open %s, %s\n", device, strerror(errno));