summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2019-04-29 14:16:17 -0500
committerDenis Kenzior <denkenz@gmail.com>2019-04-29 14:16:17 -0500
commit4a93c329b9139af380da49ef373e7ad72834d210 (patch)
tree7241bb34e6fd50323e083fc82c1f4d77df4fa593 /src
parentb126407632ef5f2c1196aef666d0fb09547acaa5 (diff)
downloadofono-4a93c329b9139af380da49ef373e7ad72834d210.tar.gz
log: Fix potential buffer overflow
We pass in the maximum size of the buffer to the read system call. On the astronomically unlikely chance that we indeed read the full buffer full of data, the subsequent assignment will overflow it. Fix this by passing sizeof(buf) - 1 to the read system call instead.
Diffstat (limited to 'src')
-rw-r--r--src/log.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index 8047084c..b3bcbc2c 100644
--- a/src/log.c
+++ b/src/log.c
@@ -185,7 +185,7 @@ static void print_backtrace(unsigned int offset)
if (written < 0)
break;
- len = read(infd[0], buf, sizeof(buf));
+ len = read(infd[0], buf, sizeof(buf) - 1);
if (len < 0)
break;