aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/iseries.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2019-03-25 10:20:10 +0100
committerDario Lombardo <lomato@gmail.com>2019-04-04 06:17:22 +0000
commitb39a736e918294f27b8218c1b2dd8ac82fbb77e6 (patch)
tree9dfe09d147895c51cd1c5c3334c20fd20de14b82 /wiretap/iseries.c
parent8d3ac3af866ecc7b847dd5b621d828872fe9ba18 (diff)
iseries: ensure the buffer is null terminated.
Check buflen to prevent wrong scanf call as well. Bug: 15614 Change-Id: I58a2855d8b1beda067bf9b2d724229ab20249228 Reviewed-on: https://code.wireshark.org/review/32573 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Dario Lombardo <lomato@gmail.com>
Diffstat (limited to 'wiretap/iseries.c')
-rw-r--r--wiretap/iseries.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/wiretap/iseries.c b/wiretap/iseries.c
index 9911cc39d2..3a53e6495a 100644
--- a/wiretap/iseries.c
+++ b/wiretap/iseries.c
@@ -431,6 +431,11 @@ iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info)
buflen = (long) strlen (buf);
}
ascii_strup_inplace (buf);
+ /* Check we have enough data in the line */
+ if (buflen < 78)
+ {
+ continue;
+ }
/* If packet header found return the offset */
num_items_scanned =
sscanf (buf+78,
@@ -985,8 +990,10 @@ iseries_UNICODE_to_ASCII (guint8 * buf, guint bytes)
bufptr++;
}
if (buf[i] == 0x0A)
- return i;
+ break;
}
+ g_assert(bufptr < buf + bytes);
+ *bufptr = '\0';
return i;
}