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>
This commit is contained in:
parent
8d3ac3af86
commit
b39a736e91
|
@ -159,7 +159,7 @@ CHECKAPI(
|
|||
NAME
|
||||
wiretap
|
||||
SWITCHES
|
||||
--group abort:10 --summary-group abort
|
||||
--group abort:11 --summary-group abort
|
||||
--group termoutput:1 --summary-group termoutput
|
||||
--build
|
||||
SOURCES
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue