This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

I may sound pretty novice but i just want to avoid any silly mistakes. Do these two functions work properly with negative offset ?

tvb_get_ntoh24 , tvb_get_guint8

Thanks in advance!!

asked 13 Aug '12, 04:13

yogeshg's gravatar image

yogeshg
41222326
accept rate: 0%


I believe so, both those functions, and most of the other tvb accessors, take a gint for offset where a negative value indicates bytes from the end of the buffer to start at.

permanent link

answered 13 Aug '12, 04:45

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

Okay , so if (tvb,0) points to chunk of address from 10 to 20 then (tvb,-1) will point to 19 rather than 9. Am i getting it correct ?

(13 Aug '12, 04:58) yogeshg

Say your tvb has 20 bytes in it, then (tvb, -1) will point to offset 19. You can't "step back" into data before the start of the tvb, that will be held in a different tvb owned by the preceding dissector.

(13 Aug '12, 06:44) grahamb ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,620
×173

question asked: 13 Aug '12, 04:13

question was seen: 2,947 times

last updated: 13 Aug '12, 06:44

p​o​w​e​r​e​d by O​S​Q​A