summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-07-21 08:05:22 +0200
committerHarald Welte <laforge@gnumonks.org>2019-07-21 08:05:22 +0200
commit7f7a7c850e404d24cd3bc9d2b9b408287e4e0ba0 (patch)
tree9c958c2fe5da915b0d1944190b372a24a4b77578 /src
parent4b742700a4457723652dd37c833a1b101583a7a3 (diff)
osmocon: Fix out-of-bounds for partial reads in un_tool_read()
"uint8_t buf[4096]; ... &buf + 1" renders an offset of 4096, and not 1! Change-Id: Ie1407371fe949c3d5746b9fdc32ececc9443692b Closes: CID#198580
Diffstat (limited to 'src')
-rw-r--r--src/host/osmocon/osmocon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index 26416f7..9090d27 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -1242,7 +1242,7 @@ static int un_tool_read(struct osmo_fd *fd, unsigned int flags)
c = 0;
while(c < 2) {
- rc = read(fd->fd, &buf + c, 2 - c);
+ rc = read(fd->fd, buf + c, 2 - c);
if(rc == 0) {
// disconnect
goto close;
@@ -1262,7 +1262,7 @@ static int un_tool_read(struct osmo_fd *fd, unsigned int flags)
c = 0;
while(c < length) {
- rc = read(fd->fd, &buf + c, length - c);
+ rc = read(fd->fd, buf + c, length - c);
if(rc == 0) {
// disconnect
goto close;