FPII-2183: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process
Bug: 28885210
Change-Id: I42fe6830d2f03ea12c4016a11c2eb5cea2903020
diff --git a/hci/src/btsnoop.c b/hci/src/btsnoop.c
index e31af35..1fc350a 100644
--- a/hci/src/btsnoop.c
+++ b/hci/src/btsnoop.c
@@ -66,7 +66,7 @@
static void btsnoop_write(const void *data, size_t length) {
if (hci_btsnoop_fd != -1)
- write(hci_btsnoop_fd, data, length);
+ TEMP_FAILURE_RETRY(write(hci_btsnoop_fd, data, length));
btsnoop_net_write(data, length);
}
@@ -139,16 +139,16 @@
rename(p_path, fname_backup);
}
- hci_btsnoop_fd = open(p_path,
+ hci_btsnoop_fd = TEMP_FAILURE_RETRY(open(p_path,
O_WRONLY | O_CREAT | O_TRUNC,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH));
if (hci_btsnoop_fd == -1) {
ALOGE("%s unable to open '%s': %s", __func__, p_path, strerror(errno));
return;
}
- write(hci_btsnoop_fd, "btsnoop\0\0\0\0\1\0\0\x3\xea", 16);
+ TEMP_FAILURE_RETRY(write(hci_btsnoop_fd, "btsnoop\0\0\0\0\1\0\0\x3\xea", 16));
}
void btsnoop_close(void) {