aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbparse.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2014-08-28 20:08:39 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2014-09-03 20:32:07 +0000
commit3e5ef80b29eb8f7938e8583500671d1ea7397bdd (patch)
treeae04479ea08b52ef63717f8c4e35a67715f35b05 /epan/tvbparse.c
parent660da5ea16da8aaf544b465512da729b068e1f06 (diff)
tvbparse: do not increment the token length when the new sub token length is 0
It fixes the unwanted addition of ignore characters when using tvbparse_some as seen with the capture from bug 10417 Change-Id: If68b587e1821fb34aa1fb56666986e1fa6385c33 Reviewed-on: https://code.wireshark.org/review/3905 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/tvbparse.c')
-rw-r--r--epan/tvbparse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/epan/tvbparse.c b/epan/tvbparse.c
index 97514d9b1c..4a7cba0897 100644
--- a/epan/tvbparse.c
+++ b/epan/tvbparse.c
@@ -583,7 +583,8 @@ static int cond_seq(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted
if (len >= 0) {
if (ret_tok) {
- ret_tok->len = (new_elem->offset - ret_tok->offset) + new_elem->len;
+ if (new_elem->len)
+ ret_tok->len = (new_elem->offset - ret_tok->offset) + new_elem->len;
ret_tok->sub->last->next = new_elem;
ret_tok->sub->last = new_elem;
} else {
@@ -661,7 +662,8 @@ static int cond_some(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wante
if(consumed >= 0) {
if (ret_tok) {
- ret_tok->len = (new_elem->offset - ret_tok->offset) + new_elem->len;
+ if (new_elem->len)
+ ret_tok->len = (new_elem->offset - ret_tok->offset) + new_elem->len;
if (ret_tok->sub) {
ret_tok->sub->last->next = new_elem;