summaryrefslogtreecommitdiffstats
path: root/hci/src/btsnoop.c
diff options
context:
space:
mode:
authorSharvil Nanavati <sharvil@google.com>2016-06-20 19:16:12 -0700
committerZach Jang <zachjang@google.com>2016-06-22 16:28:31 -0700
commit472271b153c5dc53c28beac55480a8d8434b2d5c (patch)
tree9112405a19254acdd7e1b37b4d667135cc0e2764 /hci/src/btsnoop.c
parent514139f4b40cbb035bb92f3e24d5a389d75db9e6 (diff)
downloadandroid_system_bt-472271b153c5dc53c28beac55480a8d8434b2d5c.tar.gz
android_system_bt-472271b153c5dc53c28beac55480a8d8434b2d5c.tar.bz2
android_system_bt-472271b153c5dc53c28beac55480a8d8434b2d5c.zip
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process
Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta_hh_co.c btif/src/btif_core.c Merge conflict resolution of ag/1161415 (referencing ag/1164670) - Directly into mnc-mr2-release
Diffstat (limited to 'hci/src/btsnoop.c')
-rw-r--r--hci/src/btsnoop.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hci/src/btsnoop.c b/hci/src/btsnoop.c
index d859e6842..7b6b97f30 100644
--- a/hci/src/btsnoop.c
+++ b/hci/src/btsnoop.c
@@ -169,14 +169,14 @@ static void update_logging() {
LOG_ERROR("%s unable to rename '%s' to '%s': %s", __func__, log_path, last_log_path, strerror(errno));
}
- logfile_fd = open(log_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
+ logfile_fd = TEMP_FAILURE_RETRY(open(log_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH));
if (logfile_fd == INVALID_FD) {
LOG_ERROR("%s unable to open '%s': %s", __func__, log_path, strerror(errno));
is_logging = false;
return;
}
- write(logfile_fd, "btsnoop\0\0\0\0\1\0\0\x3\xea", 16);
+ TEMP_FAILURE_RETRY(write(logfile_fd, "btsnoop\0\0\0\0\1\0\0\x3\xea", 16));
} else {
if (logfile_fd != INVALID_FD)
close(logfile_fd);
@@ -188,7 +188,7 @@ static void update_logging() {
static void btsnoop_write(const void *data, size_t length) {
if (logfile_fd != INVALID_FD)
- write(logfile_fd, data, length);
+ TEMP_FAILURE_RETRY(write(logfile_fd, data, length));
btsnoop_net_write(data, length);
}