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


when using this function it works fine but if int1 isn't found in the value_string structure then it crashes wireshark. The value_string structure looks like this:

static const value_string data[] = { { 0x01, "Test1" }, { 0x03, "Test2" }, { 0, NULL } };

so if the value 0x02 was used then wireshark would crash. I thought it would return NULL if the value wasnt found. Is there any return value I can check to make sure its returning a valid string?

asked 13 Feb '13, 14:19

StealthUE's gravatar image

accept rate: 100%

val_to_str will pass int1 to the format string if it isn't found in data. If you use "%s" as your format string and pass in the value 2 then val_to_str will go looking for a valid string at memory address 2. You might try using "%d" or "%u" instead.

permanent link

answered 13 Feb '13, 14:50

Gerald%20Combs's gravatar image

Gerald Combs ♦♦
accept rate: 24%

thanks..."%d" worked

(13 Feb '13, 15:09) StealthUE
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 13 Feb '13, 14:19

question was seen: 2,218 times

last updated: 13 Feb '13, 15:09

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