aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2017-12-26 11:48:04 +0000
committerAnders Broman <a.broman58@gmail.com>2017-12-26 20:21:04 +0000
commit137ab7d5681486c6d6cc8faac4300b7cd4ec0cf1 (patch)
tree1a00b05e7b4931dabd7b6b157d6a2ca2defad4c5 /epan/wslua
parent5153a7aba255cfcecb6e766e6dfc90ab82e8f8f7 (diff)
potential buffer underflow in File_read_line function in epan/wslua/wslua_file.c
Putting up for review, though I am not completely convinced that file_gets() can return an empty line. Bug: 14295 Change-Id: If36761ea511b66c01a9f167809a218a7eadbfcc5 Reviewed-on: https://code.wireshark.org/review/24997 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/wslua_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c
index 79bf4f7a3d..73bacc6c99 100644
--- a/epan/wslua/wslua_file.c
+++ b/epan/wslua/wslua_file.c
@@ -192,7 +192,7 @@ static int File_read_line(lua_State *L, FILE_T ft) {
length = (gint)(file_tell(ft) - pos_before);
/* ...but don't want to include newline in line length */
- if (linebuff[length-1] == '\n') {
+ if (length > 0 && linebuff[length-1] == '\n') {
length--;
/* Nor do we want '\r' (as will be written when log is created on windows) */
if (length > 0 && linebuff[length - 1] == '\r') {