From fbf1409719238051bc94d9251466f9ef5a06432b Mon Sep 17 00:00:00 2001 From: Tadeusz Struk Date: Fri, 23 Mar 2018 09:07:20 -0700 Subject: [PATCH] README.dissector: update info about tvb_get_nstringz Update invalid description for tvb_get_nstringz() and tvb_get_nstringz0(). Change-Id: I03483bc1a2aa5a701b44cd895b91289716ef215d Reviewed-on: https://code.wireshark.org/review/26598 Reviewed-by: Peter Wu Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- doc/README.dissector | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/README.dissector b/doc/README.dissector index bc4a41338f..e2aa2e10fc 100644 --- a/doc/README.dissector +++ b/doc/README.dissector @@ -360,11 +360,15 @@ sequences. gint tvb_get_nstringz(tvbuff_t *tvb, const gint offset, const guint bufsize, guint8* buffer); gint tvb_get_nstringz0(tvbuff_t *tvb, const gint offset, const guint bufsize, guint8* buffer); -Returns a null-terminated buffer containing data from the specified tvbuff, -starting at the specified offset, and containing all characters from the -tvbuff up to and including a terminating null character in the tvbuff. -"*lengthp" will be set to the length of the string, including the terminating -null. +Copies bufsize bytes, including the terminating NULL, to buffer. If a NULL +terminator is found before reaching bufsize, only the bytes up to and including +the NULL are copied. Returns the number of bytes copied (not including +terminating NULL), or -1 if the string was truncated in the buffer due to +not having reached the terminating NULL. In this case, the resulting +buffer is not NULL-terminated. +tvb_get_nstringz0() works like tvb_get_nstringz(), but never returns -1 since +the string is guaranteed to have a terminating NULL. If the string was truncated +when copied into buffer, a NULL is placed at the end of buffer to terminate it. gchar *tvb_get_ts_23_038_7bits_string(wmem_allocator_t *scope, tvbuff_t *tvb, const gint bit_offset, gint no_of_chars);