]> The Tcpdump Group git mirrors - tcpdump/commit
fix bittok2str_internal() w/o separator (GH #391)
authorDenis Ovsienko <[email protected]>
Thu, 5 Jun 2014 20:56:05 +0000 (00:56 +0400)
committerDenis Ovsienko <[email protected]>
Thu, 5 Jun 2014 20:56:05 +0000 (00:56 +0400)
commitbb9331dff5f48504824572d1f23365c16b1f9a04
treeb1db716ad930f0e52e1a82f92147a9fbe1ed3127
parentb146122e7e5b5e49ce3dfa001d977f99ae51f51a
fix bittok2str_internal() w/o separator (GH #391)

Simplify separator string handling in bittok2str_internal(): use empty
value for the first snprintf() call and set new value after each use.
This makes the terminating null char management unnecessary, especially
that it missed the case where there was no separator and no match (it
would return the previous content of the static buffer unchanged).

This change may affect the output of tcpdump in that before it could
print either "[]" or "[none]" or a string like "[S.]" for TCP flags
value 0. Now it prints "[none]" as that is exactly the value passed to
bittok2str_nosep() in tcp_print().
util.c