summaryrefslogtreecommitdiff
path: root/utils/rpctrace.c
diff options
context:
space:
mode:
authorKalle Olavi Niemitalo <kon@iki.fi>2016-08-24 00:41:30 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-23 23:48:13 +0200
commitca5b01f538c122dc1f0e989f5703c75b8cf8ca3a (patch)
tree0d6e18976962acf1c9fcaaa9cef0e53a972958d4 /utils/rpctrace.c
parent118a5b8c33cc2fad8ccdc5858253e7ed3dfca513 (diff)
rpctrace: Print beyond '\0' in MACH_MSG_TYPE_CHAR.
This will now display the 'argv: data_t' argument of file_exec as e.g. "who\0am\0i\0" rather than just "who". In contrast, the 'file_name: string_t' argument of dir_lookup will still be truncated at the first null character. The previous implementation might crash if an out-of-line char array exactly fills a page and does not contain any null characters. * utils/rpctrace.c (print_data): On MACH_MSG_TYPE_STRING and MACH_MSG_TYPE_CHAR, check for end of buffer before checking for a null character. On MACH_MSG_TYPE_CHAR only, continue printing past null characters.
Diffstat (limited to 'utils/rpctrace.c')
-rw-r--r--utils/rpctrace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 276377c0..25d9bc6e 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1524,7 +1524,8 @@ print_data (mach_msg_type_name_t type,
the first character that has not yet been printed. */
const char *p, *q;
p = q = (const char *) data;
- while (q && *q && q - (const char *) data < (int) (nelt * eltsize))
+ while (q && q - (const char *) data < (int) (nelt * eltsize)
+ && (*q || type == MACH_MSG_TYPE_CHAR))
{
if (isgraph (*q) || *q == ' ')
{